Luke Palmer wrote:
So I suppose that's my proposal. Allow, even encourage, overloading of =:=, but only for value types. I've been thinking that we ought to provide a standard role for making something a value type. Maybe it would require definition of =:=.
I would like to propose something slightly different: 1) Let =:= be non-overloadable purely macro/grammar based --- same could be applied to ::= and := I think 2) the implementation of =:= then checks type homogenity as a precondition and calls the type specific EQUAL submethod or some such The rational is that type homogenity is a necessary condition for identity and thus allows to return false when violated. The EQUAL class/type submethod could be used as the default for the == and eq operators as long as subtype homogenity for both sides holds. Well, or the operator name is a parameter to the parametric role: role Identity[ &eq_op:( ::?CLASS, ::?CLASS: --> bit ) = $::CLASS::EQUAL ] does Identity[ ::?CLASS ] # F-bounded { ... } which is implicitly forced into every class definition by virtue of role Any does Identity; In particular we have: class Num does Identity[ &infix:{'=='} ] {...} class Str does Identity[ &infix:{'eq'} ] {...} To what exteent in canbe auto-generated with dispatching to the respective methods of all elements defined into the class' value environment, I can't say. -- TSa (Thomas Sandlaß)