Value closures (no GC allocation)

Stanislav Blinov via Digitalmars-d digitalmars-d at puremagic.com
Wed May 24 20:49:24 PDT 2017


On Thursday, 25 May 2017 at 03:42:11 UTC, Adam D. Ruppe wrote:
> On Thursday, 25 May 2017 at 03:30:38 UTC, Stanislav Blinov 
> wrote:
>> Captures, if any, should be explicit. That is all :)
>
> The current behavior is fine in most cases. The explicit 
> by-value capture handles the remaining cases.

In my opinion, it is not, because it's utterly silent unless you 
either stumble upon it via @nogc or a compiler switch.

>> By inference, adding capture syntax at all will also 
>> complicate the whole thing.
>
> Yeah, there's some complication in adding it but it is worth it 
> because it gives something new without breaking anything old.
>
>> P.S. have you seen the TODO at the bottom of that section?
>
> Yeah, I'm EXTREMELY against removing the current behavior. I'd 
> kill the whole thing just to avoid that.

I understand perfectly, wasn't exactly easy contemplating that 
"maybe" either. In any case, we should not get ahead of 
ourselves. I'm not insisting on that particular change, I've 
brought it up for consideration, opened a discussion, and it 
looks like it worked :)


More information about the Digitalmars-d mailing list