deprecate boolean evaluation of floating point and character types
Quirin Schroll
qs.il.paperinik at gmail.com
Thu May 16 18:03:30 UTC 2024
On Wednesday, 1 May 2024 at 10:01:29 UTC, Nick Treleaven wrote:
> On Tuesday, 30 April 2024 at 17:01:42 UTC, Basile B. wrote:
>> Generally there is a strong correlation between default
>> initialization and boolean evaluation to `false`.
>
> But the meaning of boolean evaluation of a number is to check
> if it is non-zero. That is well established from C.
Without looking it up, if `x` is `-0.0`, does `!x` evaluate to
`true` or `false`?
Hint: Negative zero compares equal to zero (`x == 0.0`), but it’s
not zero: `x !is 0.0`.
Possibly after looking it up, does the answer make sense to you?
Even if you’re 100% sure, would you bet most D programmers get it
right?
More information about the dip.ideas
mailing list