`of` operator ES7 proposal from Ian Bicking
brendan at mozilla.org
Mon Mar 30 20:49:29 UTC 2015
There's no problem making `of` contextual provided you use a restricted
RelationalExpression [no LineTerminator here] |of| ShiftExpression _
we noticed that restricted productions allow the contextual use of new
keyword-operators without breaking backward compatibility.
> 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).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss