On Tuesday, 7 June 2016 at 08:50:07 UTC, Robert burner Schadek wrote:
PR: https://github.com/dlang/phobos/pull/4407

I also have

https://github.com/nordlow/phobos-next/blob/master/src/bound.d
providing Ada-style range type at
https://github.com/nordlow/phobos-next/blob/master/src/bound.d#L286

and

https://github.com/nordlow/phobos-next/blob/master/src/modulo.d
providing Ada-style module type at
https://github.com/nordlow/phobos-next/blob/master/src/modulo.d#L46

I'm currently using `Mod` in an useful way here
https://github.com/nordlow/phobos-next/blob/master/src/typecons_ex.d#L227
unittested here
https://github.com/nordlow/phobos-next/blob/master/src/typecons_ex.d#L286

to automatically get bounded integers when searching for elements in static arrays. In turn, I'm using this in my radix tree implementation here

https://github.com/nordlow/phobos-next/blob/master/src/trie.d#L922

to provide more type-safe indexing of statically sized arryas.

I know, it's big, but it *is* motivated when accessing static arrays in specialized containers like radix trees.

Have you thought about extending checkedint to something similar to bounded integer wrapper type like my `bound.d`?

Not that my `Bound`-type probably should be used inplace of `Mod`, but I haven't had time to do the switch yet.

Reply via email to