We need to have a way to say "convert this nested function into a struct"

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 28 18:58:22 PDT 2015


On Saturday, 6 June 2015 at 12:42:38 UTC, Marc Schütz wrote:
> On Saturday, 6 June 2015 at 06:16:17 UTC, Andrei Alexandrescu 
> wrote:
>> Nested functions that allocate their environment dynamically 
>> can be quite useful. However, oftentimes the need is to 
>> convert the code plus the data needed into an anonymous struct 
>> that copies the state inside, similar to C++ lambdas that 
>> capture by value.
>>
>> I wonder how to integrate that within the language nicely.
>>
>>
>> Andrei
>
> Related: deadalnix's DIP30 contains a section about fully-typed 
> delegates:
> http://wiki.dlang.org/DIP30

Damn it, I should have read the full thread :)


More information about the Digitalmars-d mailing list