Improving ECMAScript as a compilation target
brendan at mozilla.com
Mon May 4 20:54:58 PDT 2009
Two open issues remain:
On May 4, 2009, at 6:20 PM, Allen Wirfs-Brock wrote:
> In the function defined for the example's invoke item the first
> argument to apply probably should be obj rather than peer.
Possibly, but in the example peer[id] may be a function that insists
on |this| being bound to peer, not obj. If the function is pure, the
arguments flow in and a result comes back, and the catchall delegates
without mutating peer or obj. If the function mutates |this|, then the
effects can be recovered by calling other methods, or by property
access, which again is delegated without a wrapper.
> I would be inclined to specify an additional argument (probably the
> first) for each handler function that would be passed the "this"
> value. Closure capture like is done in the example works but my
> intuition is that there will be situations where it would be handy
> to use the same catch-all descriptor for several objects.
Agreed, but why not use |this| instead of an extra (leading) parameter?
More information about the es-discuss