length's type.

bachmeier no at spam.net
Mon Feb 12 19:34:36 UTC 2024


On Monday, 12 February 2024 at 18:22:46 UTC, H. S. Teoh wrote:

> Honestly, I think this issue is blown completely out of 
> proportion.

Only for people that don't have to deal with the problems it 
causes.

> D decided on an unsigned type. You just learn that and adapt 
> your code accordingly, end of story.  Issues like these can 
> always be argued both ways, and the amount of energy spent in 
> these debates far outweigh the trivial workarounds in code, of 
> which there are many (use std.conv.to for bounds checks, just 
> outright cast it if you know what you're doing (or just 
> foolhardy), use CheckedInt, etc.).

A terrible language is one that makes you expend your energy 
thinking about workarounds rather than solving your problems. The 
default should be code that works. The workarounds should be for 
cases where you want to do something extremely unusual like 
subtracting from an unsigned type and having it wrap around.


More information about the Digitalmars-d-learn mailing list