2 ms·
> Especially with Number, I often have the sensation that the type system just doesn't have my back. That's sounding dangerously close to dependent types, whic
by tshaddox 2y ago
> Especially with Number, I often have the sensation that the type system just doesn't have my back.
That's sounding dangerously close to dependent types, which are awesome but barely exist in any programming languages, let alone mainstream general purpose programming languages.
You could do this with a branded type. The downside will be ergonomics, since you can't safely use e.g. the normal arithmetic operators on these restricted integer types.