News for hackers. Stuff that matters.
Re:Safe C++ proposal is not being continued by int_19h on Sunday September 14, 2025 @12:41AM (#45237493)
Proper union types would get you there. If you have them, then each specific integer constant is basically its own type, and e.g. uint8 is just (0|1|2|...|255). So long as your type algebra has an operator that excludes one of the variants from the union to produce a new one, it's trivial to exclude whatever, and it's still easy for the compiler to reason about such types and to provide syntactic sugar for them like 0..255 etc.

There are no comments on this comment yet.