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?
Presumably because you can't call them without being ambiguous with the keyword.
~TJ
domenic at domenicdenicola.com (2013-08-23T13:41:10.619Z)
Presumably because you can't call them without being ambiguous with the keyword.
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? Presumably because you can't call them without being ambiguous with the keyword. ~TJ