for own(...) loop (spin-off from Re:, hasOwnProperty(), and inheritance)

David Herman dherman at
Tue Nov 8 20:39:14 PST 2011

> Still there, but write it out fully, to compare to the cited text:
>   import keys from "@iter";
>   for (i of keys(o)) {
>     body
>   }
> Unless we default-import a standard prelude,

I think we should.

> this is a bit much compared to add own as a modifier after for in for/in (not for/of) loops.

For for-of semantics is one of the places we've bought into a "do-over" for a JS form. It muddies the waters to say "for-of is the new for-in" but also halfway reform for-in at the same time. I don't really think

    for (i of keys(o)) {

is such a burden (two characters, as you say).

Instead of taking a hard-to-use-right form like for-in and partly taming it, I'd rather suggest people simply move to for-of, and have the default keys iterator Do The Right Thing and only iterate over own, enumerable property names (thanks to Yehuda and Arv for straightening us out on this point recently).


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list