delegating to typed objects

Kris Zyp kriszyp at
Mon Jul 9 15:39:52 PDT 2007

Is class like inheritance just too much of an implementation burden? Is it
hard for new F objects to be an instantiation of C like subtypes of C would
be? It stills seems to me consistency with the behavior of the rest of ES
would suggest class like inheritance. If an error was to be thrown, where
would the error occur in this example?

On 7/9/07, Jeff Dyer <jodyer at> wrote:
> 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
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Es4-discuss mailing list