Missing python-like chaining in D

Ali Çehreli acehreli at yahoo.com
Tue Feb 22 17:27:33 UTC 2022


On 2/22/22 06:42, Dom DiSc wrote:

 > and if the chain gets longer, even more complicated:
 >
 > a > b > c <= d
 >
 > will  be lowered to
 >
 > auto tmp1 = b;
 > auto tmp2 = c;
 > a > tmp1 && tmp1 > tmp2 && tmp2 <= d
 >
 > and so on.

No, it is a little more complicated than that. Unlike your equivalent, 
Python evaluates c only if a > tmp1 is true.

Ali



More information about the Digitalmars-d mailing list