deprecate boolean evaluation of floating point and character types
Nick Treleaven
nick at geany.org
Wed May 1 10:01:29 UTC 2024
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.
> instead of an assertion failure what we should get is rather a
> message such as
>
> error, cannot evaluate `f64` to a `bool`
Why break D code that was written with the non-zero test
expectation? Why make porting from C harder yet still allow
non-zero tests for integers? Wouldn't that be more confusing?
More information about the dip.ideas
mailing list