There's no problem making `of` contextual provided you use a restricted
production:
RelationalExpression :
RelationalExpression [no LineTerminator here] |of| ShiftExpression _
See
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.
/be
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
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss