Lazy and delegates - out-of-scopeness - what happens?

Cecil ward janet at janetward.com
Thu Jul 14 11:42:01 PDT 2011


If I pass lazy expressions or delegates to as arguments to functions, what happens with variables mentioned in the
lazy expression or in the delegate body if those variables are on the stack or otherwise out of scope, or are objects
that may be freed? Does the compiler partially protect the programmer from mistakes here?

If anyone can comment on how these features are implemented in generated code wrt stack-allocated objects that
are _in_ lexical scope in a delegate evaluation context, then I'd be interested to hear about this.


More information about the Digitalmars-d-learn mailing list