Denis Koroskin:
>I don't see any reason why if (someComplexNumber) { ... } should be a
valid code, it hardly makes any sense for me.<
In general I think adding a boolean-evaluation standard method to D can be
positive and handy and not that bug-prone.
But complex numbers are FP, so you usually test if they are close to zero (test
of exactly zero can be useful to know if a value was not changed, etc). So I
agree with you that for complex numbers such boolarn-eveluation method isn't
very useful.
Once D has such operator, it can be defined for library complex numbers too,
but probably it will not be used often.
It's useful if you want to write generic code, so if in a templated function
you use if(x){... it will work with integers, double, complex values, etc,
without special casing.
Bye,
bearophile