deprecate boolean evaluation of floating point and character types

Basile B. b2.temp at gmx.com
Tue Apr 30 17:01:42 UTC 2024


Generally there is a strong correlation between default 
initialization and boolean evaluation to `false`. Excepted for 
floating point and characters types :

```d
void main(string[] args)
{
     void* v;
     assert(!v);
     int s32;
     assert(!s32);
     long s64;
     assert(!s64);

     class C {}
     C c;
     assert(!c);

     struct S { bool opCast(T)(){return true;} }
     S s;
     assert(s);

     // etc ...

     float f64;
     assert(!f64);
}
```

instead of an assertion failure what we should get is rather a 
message such as

    error, cannot evaluate `f64` to a `bool`


More information about the dip.ideas mailing list