Lazy eval -- an example issue
BCS
BCS at pathlink.com
Wed Aug 23 08:48:42 PDT 2006
Walter Bright wrote:
> Sean Kelly wrote:
>
>> Walter Bright wrote:
>>
>>>
>>> 3) It is possible that the delegate can be inlined, thus eliminating
>>> any extra overhead.
>>
>>
>> Really? Are you saying that if the receiving function is short enough
>> the function and its delegate use may be inlined in the calling code?
>> I can't imagine that it would simply be inlined in the receiving
>> function and duplicates of that wold be generated. Or at least, DMD
>> doesn't appear to do that now.
>
>
> It doesn't do it now, but it is possible to do. What an advanced
> compiler can do is duplicate the function into two, one gets the value
> arguments that have no computation, the other gets the side effect
> arguments and ones that involve computation as delegates.
a.k.a
foo(char[] delegate())
gets converted by the compiler into
foo(char[] delegate())
foo(char[])
???
That would be REALLY cool. But I'm not sure I trust the compiler that much.
More information about the Digitalmars-d
mailing list