`of` operator ES7 proposal from Ian Bicking

Bergi a.d.bergi at web.de
Mon Mar 30 19:45:57 UTC 2015

Brendan Eich schrieb:
>  From https://plus.google.com/+IanBicking/posts/PbXDtNF9Gg6:
> Huh, "for (attr in obj)" goes along with "if (attr in obj)", but "for
> (item of array)" doesn't have an equivalent "if (item of array)"
> It's obvious in hindsight. An `of` operator …

I would like such an operator as well, but I can see a big problem with 
this proposal: "of" is not a reserved keyword.
And it certainly has its usage as an identifier name already, most 
prominently: Array.of.
The fantasyland applicatives 
<https://github.com/fantasyland/fantasy-land#applicative> do have such a 
method as well. I found a few uses of it in github code 
(most of those thousands are false positives or a particular test case, 
this example 
is not).


More information about the es-discuss mailing list