delegating to typed objects

Jeff Dyer jodyer at adobe.com
Mon Jul 9 15:22:30 PDT 2007




On 7/9/07 2:42 PM, Kris Zyp wrote:

> It seems to me that transfering bound methods to the function instances makes
> the situation equally confusing:
> Now if write:
> class C { var x : String; function m() : String { return this.x }}
> c = new C;
> function F() {}
> F.prototype=c;
> f = new F; // f.__proto__ = c
> f.x =4;
> f.m() -> ???
> A Transferred bound method would mean that when we call f.m(), that the "this"
> in the method execution is actually c and not f. Does that really make sense?
> 
Agreed. This presents a usability hazard. It has been suggested that if Œf¹
is not compatible with class C, then an error should be raised. This might
be an alternative that avoids the copying of fixtures or other class like
inheritance mechanisms to ensure type safety.

I agree with Brendan that there has to be a rational explanation (and
reference implementation) of the behavior of this feature, but if there are
only edge use cases punting with an exception might be just fine.

Jd

> Kris
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20070709/de069c3c/attachment-0002.html 


More information about the Es4-discuss mailing list