« Bugzilla Issues Index

#1464 — 13.5 Class Definitions, Static Semantics: remove Identifier name restriction (eval, arguments)

Based on the discovery and discussion here:


- It is a Syntax Error if BoundNames of BindingIdentifier contains either ″eval″ or ″arguments″

Do we really want to allow binding of "eval" and "arguments" using class, let, and const? We would totally outlaw all declarations of those names (like we do in strict mode) except that we have to allow them in non-strict var/function/catch for legacy compatibility. But here we are talking about new declaration forms so there is no legacy to be compatible with.

Is there an actual record of a discussion on this issue somewhere? I don't see it addressed in the jshint class issue.

I dont know why github hides older discussion, but here's the direct link:

Thanks, got it.

The explicit restriction for ClassDeclaration is already gone from the draft and the same restrictions apply there as to any other use of BindingIdentifier (which is illegal in strict code)

I still think there is an argument for never allowing the "eval" and "arguments" in new declaration form, even for non-strict code. Do you recall whether we have discussed this at TC39?

We haven't, but I would be in favor of forbidding these identifiers by default.

I wont be in London, you may speak for me on this issue.

Also see bug 1729

fixed in rev17 editor's draft.

A class definition is always strict code so it can't create bindings named 'eval' or 'arguments'

fixed in rev17, August 23, 2013 draft