`of` operator ES7 proposal from Ian Bicking

Brendan Eich 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 :
RelationalExpression [no LineTerminator here] |of| ShiftExpression _

http://wiki.ecmascript.org/doku.php?id=harmony:egal#is_and_isnt_operators where 
we noticed that restricted productions allow the contextual use of new 
keyword-operators without breaking backward compatibility.


Bergi wrote:
> 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 
> <https://github.com/search?l=javascript&q=%22var+of+%3D+%22&ref=searchresults&type=Code> 
> (most of those thousands are false positives or a particular test 
> case, this example 
> <https://github.com/ELLIOTTCABLE/from/blob/fb19155abbf39e91a532537599d3d16f592e16b6/lib/from-new.js#L96> 
> is not).
>  Bergi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150330/804cd938/attachment-0001.html>

More information about the es-discuss mailing list