[[Enumerate]] and enumerate and keys trap
allen at wirfs-brock.com
Mon Oct 8 12:21:21 PDT 2012
On Oct 8, 2012, at 11:34 AM, Tom Van Cutsem wrote:
> 2012/10/8 Allen Wirfs-Brock <allen at wirfs-brock.com>
> Then we should also have the enumerate trap.
> Absolutely. I wasn't arguing to get rid of it.
>> I'm all for internal spec refactorings to avoid duplication, but I feel this particular refactoring is better left invisible to users.
> I definitely want the internal methods and traps to be completely parallel. If we take the path suggested above I will add the equivalent of [[keys]] and [[getOwnPropertyNames]] as essential internal methods and get rid of the parameters to [[Enumerate]].
> I wouldn't mind if the [[Keys]], [[GetOwnPropertyNames]] and [[Enumerate]] internal methods dispatched to an internal GetPropertyKeys helper function with flags. In fact, why don't we let [[Keys]] and [[GetOwnPropertyNames]] dispatch to a helper parameterized by just an "enumerableOnly" flag. The [[Enumerate]] trap is the only one that does a proto-chain-walk, it probably deserves its own internal method despite a little redundancy in querying the own property names.
Internal abstraction operations (helper functions) are just editorial devices that reduce the need to duplicate (and perhaps introducing errors) specification steps. If it makes sense I'll use one in specifying these traps, but it doesn't make a normative difference to the specification.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss