Voting for std.experimental.checkedint

Vladimir Panteleev via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 25 08:00:21 PST 2017


On Saturday, 25 February 2017 at 15:21:10 UTC, Andrei 
Alexandrescu wrote:
> On 02/25/2017 10:17 AM, rumbu wrote:
>> A lot of bloat code for something extremely basic.
>
> If you can do it with less code, I'm all ears. Thanks! -- Andrei

Perhaps a simpler example for the most basic use case could be 
added near the top. In the heat of solving a problem, 
encountering two pages of theory and explanation for something 
the usage of which should be simple might be discouraging.

Basically, something like:

writeln((checked(5) + 7).get); // 12
writeln((checked(10) * 1000 * 1000 * 1000).get); // Overflow on 
binary operator



More information about the Digitalmars-d mailing list