Operator overloading revisited

P T Withington ptw at pobox.com
Tue Jun 30 11:29:08 PDT 2009


On 2009-06-30, at 14:06EDT, Brendan Eich wrote:

> These are nice generic functions. With type annotations or guards,  
> you could imagine them as adding to generic function "+":
>
>  generic function "+"(a :Point, b :Point) {
>    return new Point(a.x + b.x, a.y + b.y);
>  }
>
> Syntax is not the point, please hold fire and spare the bikeshed --  
> the unencapsulated (no |this| or |self|) nature of these functions  
> is what I'm stressing.

+∞ again

> If the reason is to assign responsibility to the different  
> constructors [*]

I don't understand the "assign responsibility" argument.  Is this  
about aligning (conflating?) security/access-control with classes/ 
instances?

Isn't a generic function a class that you could assign responsibility  
to?



More information about the es-discuss mailing list