Project Elvis
Ola Fosheim Grøstad
ola.fosheim.grostad+dlang at gmail.com
Sun Oct 29 16:44:39 UTC 2017
On Sunday, 29 October 2017 at 16:29:57 UTC, Jonathan M Davis
wrote:
> valid using ?:, I would think that you'd want to be doing the
> same check with stuff like if statements anyway. So, it sounds
> to me like overloading opCast!bool would work just fine.
If you try to do:
some_float ?: 0.0
then it will do nothing as cast(bool)std.math.NaN(0) => true
But that is just one of many possible examples. The elvis
operator as proposed does not match on nullity / invalid state.
More information about the Digitalmars-d
mailing list