Allowing Expressions such as (low < value < high)

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 4 13:03:56 PDT 2014


Are there any programming languages that extend the behaviour of 
comparison operators to allow expressions such as

     if (low < value < high)

?

This syntax is currently disallowed by DMD.

I'm aware of the risk of a programmer misinterpreting this as

     if ((low < value) < high)

Is this the reason why no languages (including D allows it).

I'm asking for in some cases, where value is a long expression, 
it would be a nice syntatic sugar to use.


More information about the Digitalmars-d-learn mailing list