Missing python-like chaining in D

Paul Backus snarwin at gmail.com
Sun Feb 27 02:59:54 UTC 2022


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 ;-)

writeln(mixin(chainCmp("1 < 2 < 3 < 4 > 3 == 3"))); // true

Implementation is left as an exercise to the reader. :)


More information about the Digitalmars-d mailing list