[OT] The Usual Arithmetic Confusions

Adam D Ruppe destructionator at gmail.com
Sat Feb 5 03:48:15 UTC 2022


On Saturday, 5 February 2022 at 02:43:27 UTC, Walter Bright wrote:
> We considered that and chose not to go that route, on the 
> grounds that we were trying to minimize invisible truncation.

I know how D works. I know why it works that way. Hell, I 
implemented part of the VRP code in dmd myself and have explained 
it to who knows how many new users over the last 15 years.

What I'm telling you is *it doesn't actually work*.

These forced explicit casts rarely prevent real bugs and in 
exchange, they make the language significantly harder to use and 
create their own problems down the line.

Loosening the rules would reduce the burden of the many, many, 
many false positives forcing harmful casts while keeping the 
spirit of the rule. It isn't just *invisible* truncation you want 
to minimize - it is *buggy* invisible truncation.

You want the compiler (and the casts) to call out potentially 
buggy areas so when it cries wolf, you actually look for a wolf 
that's probably there.


More information about the Digitalmars-d mailing list