Standard @iter module unfriendly to collection builders

Erik Arvidsson erik.arvidsson at gmail.com
Mon Nov 14 11:59:25 PST 2011


On Mon, Nov 14, 2011 at 09:07, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> Another possibility would be to build in default @iterator methods on
> Object.prototype and Array.prototype.  I'd probably make the object
> implementation be an items for enumerable properties and the array
> implementation iterate the values of 0..length-1 .

Defining @iterator on Object.prototype seems like it would be a
disservice to future js programmers. It would basically turn the
for-of loop into another reflection based loop and we would be back to
square one.

I'm in favor of Array.prototype. at iterator though


-- 
erik


More information about the es-discuss mailing list