Lazy evaluation

Regan Heath regan at netmail.co.nz
Thu Jun 28 01:08:21 PDT 2007


Lutger Wrote:
> BCS wrote:
> > OF wrote:
> >> It hints at lazyexp not being valid after the function has ended, 
> >> which makes it quite different from delegates.
> > 
> > This is the /exact/ behavior of delegate liters and delegates formed 
> > from nested functions. They are invalid after the function call they are 
> > from returns. This is because the delegate caries a pointer to the stack 
> > frame of the surrounding function.
> 
> Yeah, but only when you access some variables through this pointer right?

If you don't need to do that then you want a function as opposed to a delegate, right?  Is such a thing possible in D, function literals.  You might need to explicitly say 'function' in there somewhere.  I've not used these a heck of a lot so I'm not sure.

Regan



More information about the Digitalmars-d mailing list