archives

« Bugzilla Issues Index

#785 — Refactor [[Enumerate]] signature


As discussed on es-discuss (see <https://mail.mozilla.org/pipermail/es-discuss/2012-October/025654.html>), it would be beneficial if the current [[Enumerate]](includePrototype, onlyEnumerable) built-in would be refactored to better align with traps from the Proxy API.

One proposal that I made on the above-mentioned thread:

Introduce a helper function GetPropertyKeys which is equivalent to the current [[Enumerate]] built-in, but with only an enumerateOnly flag, and with includePrototype=false (i.e. it considers only "own" properties).

Introduce the following built-ins:

[[Keys]]
On built-in objects, call helper function GetPropertyKeys(enumerableOnly=true)
On proxies, call the "keys" trap

[[GetOwnPropertyNames]]
On built-in objects, call helper function GetPropertyKeys(enumerableOnly=false)
On proxies, call the "getOwnPropertyNames" trap

[[Enumerate]]
On built-in objects, specify an ad hoc algorithm that does the proto-chain-walk
On proxies, call the "enumerate" trap


done in rev 12. But we should continue to look at ways to simply the handler interface.


corrected in rev 12, Nov. 22, 2012 draft