Missing python-like chaining in D

Dukc ajieskola at gmail.com
Mon Feb 21 10:18:18 UTC 2022


On Monday, 21 February 2022 at 09:48:53 UTC, Stanislav Blinov 
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
>>
>
> I've no clue whatsoever how to interpret that mess, nor do I 
> have any desire of obtaining said clue.

`writeln(1 < 2 && 2 < 3 && 3 < 4 && 4 > 3 && 3 == 3); // true`

In a new langauge, I think it might make sense. But D is right to 
not behave that way because of the design goal to avoid silently 
changing C semantics.


More information about the Digitalmars-d mailing list