Whether keywords should be allowed as names in function declarations

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Tue Jan 20 14:14:11 PST 2009

David-Sarah Hopwood wrote:
> Allowing keywords as function names makes for worse diagnostics in cases
> where the use of a keyword was unintentional. Consider
>   function delete(foo) { ... }
>   ...
>   delete(bar);
> 'delete' in this example could also be 'if' (as also pointed out by MarkM),
> 'new', 'this', 'throw', 'typeof', 'while', and probably 'yield' in a
> future ES version.

Also 'void' and 'return', and some identifiers that are technically not
keywords but which I think have been proposed to be disallowed as function
names, such as 'arguments' and 'eval'.

David-Sarah Hopwood ⚥

More information about the Es-discuss mailing list