[Issue 13010] Use variable range propagation (VRP) for static assert
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Feb 28 06:37:44 PST 2015
https://issues.dlang.org/show_bug.cgi?id=13010
--- Comment #10 from David Nadlinger <code at klickverbot.at> ---
(In reply to Lionello Lunesu from comment #8)
> (In reply to David Nadlinger from comment #7)
> > I'm not sure whether this is worth the added language complexity. Do you
> > have an example for a compelling use case?
>
> Statically testing the range of a variable:
>
> ubyte u;
> static assert(u >= 0);
1. That's hardly what I'd call a use case. It's a minimal snippet showing a
consequence of the feature, but doesn't tell me why I would ever want to do
this in the first place.
2. In this specific case, inspecting the type (isUnsigned) would be enough
anyway.
--
More information about the Digitalmars-d-bugs
mailing list