Brendan Eich wrote: > On Jan 18, 2009, at 5:48 PM, Mark S. Miller wrote: >> On Sun, Jan 18, 2009 at 4:35 PM, Brendan Eich <[email protected]> >> wrote: >> >> We also allow keywords as property names in JS1.7+ and did for ES4 -- >> this relaxation from current context-free reservation of identifiers >> has been talked about for 3.1 too, and IIRC it was agreed to for >> Harmony at last summer's Oslo meeting. >> >> It's in the ES3.1 grammar. In ES3.1, x.if is equivalent to x['if'], >> and ({if: x}) is equivalent to ({'if': x}). > > The other unreserved context in JS1.7 and later is after the 'function' > keyword. Unambiguous, complementary, useful for some cases. It's easy to > tweak ES3.1's grammar to allow keywords in this context too. Thoughts?
For it to be useful to define functions with names that are keywords, it would also have to be possible to reference those names (preferably in an arbitrary expression context, but in ES3.1 I don't see how they could be referenced at all, except in obscure corner cases involving the global object or 'with'). -- David-Sarah Hopwood ⚥ _______________________________________________ Es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

