I’d like to propose an improvement to the way operand types are inferred.
Currently, in an expression like
x == y, type checking will fail if one of the operands’ types is omitted and there is more than one possible type. This is not optimal, because in almost all the cases where this happens, a type identical to the type on the other side is the expected choice.
My proposal is that whenever such a multiple choice occurs, instead of failing, the type checker would instead attempt to directly unify the types on both sides, give or take a reference. This would pave the way towards certain desirable additions to operands on primitive types, which up to now have been rejected because they would break inference, even though there is often just one variant that’s intuitively correct.
Would anyone be willing to mentor me in writing an RFC, as well as possibly implementing this in the compiler?