D - Unsafe and doomed

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Jan 5 02:26:33 PST 2014


On 1/5/14, Adam D. Ruppe <destructionator at gmail.com> wrote:
> On Saturday, 4 January 2014 at 22:08:59 UTC, Andrej Mitrovic
> wrote:
>> Here you go:
>
> Genius!
>
> I'm pretty happy with that, and it can be used for all kinds of
> range checks following the same pattern.

Yeah. I've actually posted about this trick a few years ago, I think
one of the main devs (Kenji/Walter) said it might be a bug that it
works, but I've been using this for years and I think it deserves to
be upgraded to be a full language feature (meaning we document it).
It's been sitting in my library, here's some unittests:

https://github.com/AndrejMitrovic/minilib/blob/master/src/minilib/core/types.d#L98

Note how you can even use enforce.


More information about the Digitalmars-d mailing list