Missing python-like chaining in D

forkit forkit at gmail.com
Wed Feb 23 19:42:53 UTC 2022


On Wednesday, 23 February 2022 at 14:38:10 UTC, 12345swordy wrote:
> On Monday, 21 February 2022 at 09:29:56 UTC, forkit wrote:
>> It seems to me, that D is a language where python like 
>> chaining would be right at home.
>>
>> writeln(1 < 2 < 3 < 4 > 3 == 3); // true
>>
>>
>> So why doesn't D have it already ;-)
>
> Why not simply allow this?
>
> writeln(1 < 2 and 2 < 3 and 3 < 4 and 4 > 3 and 3 is equal 3)?
>
> -Alex

This is not a 'must have' feature. It was just a question.

and no, your example is going in the opposite direction... i.e. 
towards unnecessary verbosity.

I want less verbosity, not more.

But D is clearly too tied to C, and becoming ever more so it 
seems.

Oddly enough, there's more chance of C++ getting chained 
comparisons ;-)



More information about the Digitalmars-d mailing list