A couple of extensions to `with` that would be worthwhile

Andrei Alexandrescu SeeWebsiteForEmail at erdani.com
Wed Oct 13 19:30:43 UTC 2021


On 2021-10-13 15:28, Adam D Ruppe wrote:
> On Wednesday, 13 October 2021 at 19:18:55 UTC, Andrei Alexandrescu wrote:
>> The point is that with keeps the entire expression live, even if you 
>> only care about a part of it:
> 
> OK, that explains things now. I see what you're going for.
> 
> Not in love with it being `with` that works differently than the other 
> `with`s but it kinda makes sense anyway.
> 
> The lambda pattern though does have a few other advantages... I think it 
> is generally easier to use... but gotta chew on it a bit.

One major issue with the lambda pattern is composition. Every layer of 
composition introduces yet another scope AND parenthesis level. That 
doesn't scale well at all.


More information about the Digitalmars-d mailing list