delegating to typed objects
brendan at mozilla.org
Mon Jul 9 16:22:14 PDT 2007
On Jul 9, 2007, at 4:16 PM, Brendan Eich wrote:
> I think we have only two courses:
> 1. Kris's proposal to make F construct instances of C. If C is not
> dynamic, these instances can't be decorated with expandos by (new
> F) or its callers.
> 2. Your proposal to avoid any magic implication of F.prototype = c,
> leaving f.x setting an unconstrained expando, leaving fixed methods
> of C this-bound to c, etc.
Sorry, the "leaving fixed methods of C this-bound to c" is a red
herring. It's true that extracting c.m or F.prototype.m would get a
bound method reference which when called would bind |this| to c --
but that's not relevant to a delegated call f.m(), which would try to
pass f, and then run into the type constraint on |this| that's
implicit in all fixed (non-prototype qualified) methods (functions
defined in class bodies).
Hope this is all clear now :-P.
More information about the Es4-discuss