Full closures

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Aug 25 06:38:18 PDT 2008


BCS wrote:
> 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.
> 
> 

I feel there is a misunderstanding here. I wasn't talking about Frank's 
closures, but the one D currently has. What exactly did you mean with 
"how else [do] you get a real closure that has mutable state?" ?

-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list