With regard to your idea about having an error without parentheses, that seems intuitive and sensible (IMO), I don’t know what you mean by ‘brittle’.
It’s brittle in the sense that it would break from very slight changes, like seemingly insignificant parentheses or extracting part of the computation into a separate bit of code and saving it as a variable.
A+1 is unambiguous, at least.Why can’t that work?
One of these operations has to not work to avoid the associativity failure:
A + I
— Matrix + UniformScalingI + 1
— UniformScaling + Number(A + I) + 1
— Matrix + NumberA + (I + 1)
— Matrix + UniformScaling
You’re arguing that A + 1
should be allowed, which is the same operation as (3) here, so one of these other operations must be disallowed in order to avoid associativity failure. Which would you get rid of? Matrix + UniformScaling (1 & 4) or UniformScaling + Number (2)?