std.experimental.checkedint is ready for comments!
tsbockman via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 14 06:58:29 PDT 2016
On Tuesday, 14 June 2016 at 10:39:01 UTC, Nordlöw wrote:
> Have you thought about extending checkedint to something
> similar to bounded integer wrapper type like my `bound.d`?
I spent some time studying the possibility of a `BoundInt` type.
Some conclusions I reached:
1) Designing and implementing `BoundInt` to my standards for
quality and
performance would be a large project of similar magnitude
to what has
already been done on `checkedint`, which took me about a
year. (And I
was building on the earlier work of @burner and others.)
2) `BoundInt` is not a replacement for `SafeInt` or
`SmartInt`, although
they would likely share some parts of the implementation.
3) Adding `BoundInt` later should not require any breaking
changes to the
public API of `checkedint`.
4) Pervasive, natural use of `BoundInt` in large systems (like
Phobos)
may cause *awful* template bloat issues, depending on the
design used.
(Improvements to the compiler front-end could mitigate this
issue, in
the long run.)
Given the above, I believe we should move forward with
`checkedint` as-is. Someone can add a `BoundInt` type to it
later, if there is demand.
More information about the Digitalmars-d
mailing list