On 1/5/14, Adam D. Ruppe <destructiona...@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.