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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Oct 14 02:55:48 UTC 2021

On 10/13/21 10:30 PM, Mathias LANG wrote:
> On Wednesday, 13 October 2021 at 19:30:43 UTC, Andrei Alexandrescu wrote:
>> 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.
> The lack of composability is annoying, but how often is it practically a 
> problem ? Those functions are used for D to C string conversion, so in 
> practice they are always at the end of the pipeline (just like `each` 
> is). I don't really see how those could justify a new language feature.

Well extendedPathThen uses toStringz :o).

More information about the Digitalmars-d mailing list