iterator as a unique name and the enumerate trap

Tom Van Cutsem tomvc.be at gmail.com
Mon Oct 1 04:12:18 PDT 2012


2012/10/1 David Bruant <bruant.d at gmail.com>

> What about making "enumerator" a unique name and remove the enumerate trap
> too?
> Proxies that want to redefine the behavior of for-in loop can just decide
> to return a different iterator than the target one.
>

Are you proposing that the unique symbol "enumerator" would then also allow
regular (non-proxy) objects to customize old for-in loops? If not, then it
makes little sense to change the interface from a trap to a unique name for
proxies.

If yes, then we should ask ourselves the question: is this a useful hook
for regular objects to customize? I think it's not, really (bear in mind
that enumeration can only generate strings (property names), it's a good
deal less generic than iteration)

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121001/751ad97f/attachment.html>


More information about the es-discuss mailing list