Lazy eval -- an example issue

Walter Bright newshound at digitalmars.com
Tue Aug 22 17:16:55 PDT 2006


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.



More information about the Digitalmars-d mailing list