Are Private name and Weak Map the same feature? and the Assoc API

Tom Van Cutsem at
Thu Dec 22 01:09:27 PST 2011

2011/12/21 Herby Vojčík <herby at>

> What about the second possibility that was there (calling a specific call
> to signal "please forward")? In my original proposal it would break
> execution of the trap immediately, but it is probably just an exception in
> disguise - it can be so that such a call sets a flag "please forward" and
> the trap function is allowed to run along until it does a return and after
> that return, the proxy machinery does the forwarding. No need to complicate
> return values by tuples, then, just set the flag and return.

I don't think that helps either:
1) You still need to allocate a separate flag per call to deal with
2) The ability to set a flag that will override a trap's return value, and
still allowing the trap to return a value can be terribly confusing:

get: function() {
  ... f(); ...
  return v;

Now, deep down in the call stack of f(), the flag is set. The value v
returned from the get trap will be ignored. The non-locality of mutating a
flag can lead to difficult to debug programs.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list