3 ms·
I think you could do that, but as long as you allow the usual operations on bounded variables (say, multiplication), you would have to ensure that the other ope
by manmal 10y ago
I think you could do that, but as long as you allow the usual operations on bounded variables (say, multiplication), you would have to ensure that the other operand is also bounded, or else you get an unbounded result nonetheless. Meaning, all variables that are used in any expression would have to be bounded eventually. There's also the problem that the compiler would have to infer that [1-10] - [1-2] can be negative, but does not have to. So with every expression on bounded variables, you increase their bounds' range, likely deleting the system's benefits.
- Mao_Zedang 10y agoI agree its super complex, these bounds wouldn't be limited to integer based variables. I would also argue there are very narrow instances where you would want to bound a variable and also do arithmetic on it. The language should make the bounding optional and unbounded possible.