On Friday, 24 June 2016 at 21:31:14 UTC, Andrei Alexandrescu wrote:
By default, if Hook has no state and implements none of these methods, e.g. is void, then Checked!(int, void) is a user-defined type that mimics the behavior of int to the maximum extent possible.

I think there is a major problem with the proposed design.

when Checked!(int, void) is to behave as an int, why do we need it in the first place. I mean we have int as a basic type. Can't we do:

alias Int = int;
alias Int = Checked!(int, SomeUsefulHook);

On second thought, the only feature of Checked!(int, void) is to be a slower int ;-)

IMO the default CheckedInt!(int, void) needs a NaN like init/failure state. After any operation that overflows the value should be NaN.


Reply via email to