Missing python-like chaining in D

Stanislav Blinov stanislav.blinov at gmail.com
Thu Feb 24 21:19:38 UTC 2022


On Thursday, 24 February 2022 at 21:05:49 UTC, H. S. Teoh wrote:
> On Thu, Feb 24, 2022 at 08:57:02PM +0000, forkit via 
> Digitalmars-d wrote: [...]
>> e.g.
>> 
>> i < 4 < n
>> 
>> once you know what the above means, it will take less 
>> cognitive effort than
>> 
>> i < 4 && 4 < n
>> 
>> not to mention less typing.
>> 
>> so everyone's a winner when you remove 'unncessary' verbosity.
>
> There's std.algorithm.ordered which lets you write:
>
> 	ordered(i, 4, n)
>
> which isn't too bad, it just needs to be promoted more so that 
> people are more aware of it.

No short circuit though. Not that I suddenly changed my mind 
about the pythonese, but if we're offering alternatives, might as 
well be thorough.


More information about the Digitalmars-d mailing list