Full closures

BCS ao at pathlink.com
Mon Aug 18 11:03:53 PDT 2008


Reply to Bruno,

> BCS wrote:
> 
>> That is a good point, but how else you you get a real closure that
>> has mutable state?
>> 
>> int delegate() Seq()
>> {
>> int at = 0;
>> int Next() { return at++; }
>> return &Next;
>> }
> Err.... just have a closure like D has now?... one that allows access
> to any visible variable?
> 

Franks local delegates won't work because they aren't valid after the other 
function returns, his heap delegates won't work because the variables they 
can access can't be altered.





More information about the Digitalmars-d mailing list