Missing python-like chaining in D

Timon Gehr timon.gehr at gmx.ch
Wed Feb 23 01:03:37 UTC 2022


On 22.02.22 11:47, Patrick Schluter wrote:
> On Tuesday, 22 February 2022 at 10:28:56 UTC, forkit wrote:
>> On Tuesday, 22 February 2022 at 09:00:10 UTC, Stanislav Blinov wrote:
>>>
>>> Call it a habit, although I'd say it's more of an allergy to 
>>> error-prone practices.
>>
>> c'mon. all other matters aside...
>>
>> ..you can't deny, that there is beauty in this mess.
>>
>> 1 < 2 < 3 < 4 > 3 == 3
> 
> Nope.

Indeed, it's not a particularly helpful motivating example. x)

I have sometimes wished for this when checking that some more 
complicated expression is within some bounds, where the expression is 
not complicated enough to justify reshaping the code and introducing a 
temporary variable.

e.g.: low <= a[2*i+1] <= high
vs:   low <= a[2*i+1] && a[2*i+1] <= high


More information about the Digitalmars-d mailing list