2012/10/8 David Bruant <[email protected]>

>  If the internal [[Enumerate]] only deals with own properties, it seems
> that the enumerate trap can be removed and for..in loop can use the keys
> and getPrototypeOf traps instead (as it does with regular objects which was
> my point 2).


It all sounds plausible. For proxies and for-in loops there's an important
inversion-of-control though: currently the proxy takes control of a for-in
loop (it decides whether to continue the loop with its prototype), with
your proposal the proxy would lose that control. For all other traps that
may be called during a prototype-chain-walk (get, set, has) the proxy
always gets to "virtualize its prototype chain".

Even if not adopting the changes I just suggested, it seems that we need
> some harmonization between the proxy traps and the internal [[Enumerate]]
> signatures.
>

Indeed. If we stick with the current [[Enumerate]](includePrototype,
onlyEnumerable) signature we'll need an ugly preamble for proxies:
- when includePrototype is false and onlyEnumerable is true, call the keys
trap
- when includePrototype is false and onlyEnumerable is false, call the
getOwnPropertyNames trap
- when includePrototype is true and onlyEnumerable is true, call the
enumerate trap
- any other combination should not occur

Cheers,
Tom
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to