Full closures

BCS ao at pathlink.com
Fri Aug 15 12:04:20 PDT 2008


Reply to Robert,

> BCS wrote:
> 
>> [...] allowing access to non const (etc.)
>> function arguments (which would be copied on function entry) and
>> variables who's scope is exactly that of the function.
>> 
>
> Ewww, -- changing the scope of the variable should never change its
> behavior, IMO.
> 

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;
}





More information about the Digitalmars-d mailing list