bzbarsky at mit.edu
Thu Dec 15 02:26:36 UTC 2016
On 12/14/16 8:47 PM, Uther Pendragon wrote:
> Perhaps it's a bit late... but I'd like to discuss the proxy object.
> Notably: why no way to define a hook for when a property is called as a
See thread at <https://esdiscuss.org/topic/es6-proxy-function-call-trap>.
> I think I understand *why* there isn't one.. I presume because how a
> property is used (I.e. as a property or called as a function) is a level
> deeper than the recalling of said property. If at all possible, I think
> it would be incredibly useful.
It's possible, in general; it was there in the proxy proposals at some
point, as the thread linked above says. It leads to weird consequences
like "foo.bar()" behaving differently from "foo.bar.call(foo)" when
everyone expects them to be the same thing.
> I presume most implementations define scope
> variables much like object properties internally.
That's not clear to me at all. In general, non-object environments
don't need to support all the operations objects do (e.g. you can't
delete bindings), so the implementation tradeoffs are quite different
and using a separate codepath for environments and object properties is
likely to be appropriate. Certainly the one implementation for which I
know this details (SpiderMonkey) has quite different implementations for
scope variables and object properties.
More information about the es-discuss