[MLton] overloading

Stephen Weeks MLton@mlton.org
Thu, 22 Jan 2004 13:40:23 -0800

> I find it a little disturbing that the constant "/"
> appears there.  I'm wondering if a more principled approach might be to
> extend the _overload syntax to
>  _overload [n] id : ty as longid [and longid]*
> where the the digit would indicate a priority.

Sounds good to me.  I view the current situation as (barely)
acceptable only because the overloading in SML is fixed.

> Then we just (stable) sort the overloads by priority and resolve.

I don't see why you need a stable sort but otherwise this makes

There is another approach, which is to implement a more powerful
overloading resolution algorithm that considers all of the overloading
to be resolved as a set of constraints and finds a solution (if there
is one) to all the constraints at once.  Although more difficult than
priorities, I might prefer that, since it has a less operational feel.
But, since the overloading in SML is fixed and the priorities are
sufficient to implement it, it feels a bit like a waste of time ...