Voting for std.experimental.checkedint

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 25 11:27:19 PST 2017


On 2/25/17 11:00 AM, Vladimir Panteleev wrote:
> 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

OK, let's do this:

https://github.com/dlang/phobos/pull/5192
https://github.com/dlang/phobos/pull/5195


Thanks,

Andrei



More information about the Digitalmars-d mailing list