Keywords as method names

Andrea Giammarchi andrea.giammarchi at gmail.com
Wed Aug 21 16:45:41 PDT 2013


`window.if = boom;`

if you really want to ... otherwise feel free to mess up with a
`with({if:yourFunc}){}` block ^_^


On Wed, Aug 21, 2013 at 4:13 PM, Jason Orendorff
<jason.orendorff at gmail.com>wrote:

> The ES6 draft says:
>
>     MethodDefinition : PropertyName ( StrictFormalParameters ) {
> FunctionBody }
>     PropertyName : IdentifierName
>
> This means a method name can be a keyword: `obj = {if() {}}`. This is
> consistent with other property names (`{if: true}` is allowed), but
> inconsistent with other function names (`function if(){}` is not
> allowed).
>
> Why not allow keywords as function names, too?
>
> -j
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130821/3582620a/attachment.html>


More information about the es-discuss mailing list