Why are shorthand operators not implemented for Measurement?

I was wondering why there are no shorthand operators (like: +=, -=, ...) implemented for measurement. They should be relatively easy to implement.

What kind of operator are you referring to?

1 Like

Operators like these: += / -= / ...

Are you referring to this Class?

1 Like

yes

When we originally proposed the feature, the compiler team was worried about adding hundreds of operator overloads for compile performance reasons. Each one adds a new possible resolution, and my understanding is that the algorithm for finding the right one does not scale linearly.

1 Like

While typechecker performance is a very valid concern, I suspect the main issues found in practice are with + more than += so holding off on those in particular probably isn’t critical (@xedin?) . And given these are resilient non-trivial types, possibly more important as performance tweaks than as just shorthand.

+= is definitely less problematic based on the limited chaining ability, which is the biggest problem associated with +, so it's safer to overload comparing to other operators but if right-hand side is complex it could still create problems.