possible excessive proxy invariants for Object.keys/etc??
rossberg at google.com
Wed Nov 21 09:59:24 PST 2012
On 21 November 2012 18:35, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> If you are writing any sort of generic algorithm that does a freeze check on an arbitrary object you have to explicitly perform all of the internal method calls because you don't know whether the object is a proxy (where every such internal method call turns into an observable trap) or even some other sort of exotic object implementation that can observe actual internal method calls. If there is explicit internal state is designate an object as frozen, then we wouldn't have all of those potentially observable calls.
Yes, but the fast path in the VM would merely check whether you have
an ordinary object with the 'frozen' flag set. Only if that fails, or
for (most) proxies and other exotics, you have to fall back to do
something more complicated. Presumably, most practical use cases would
never hit that.
More information about the es-discuss