« Bugzilla Issues Index

#1243 — [11.4.1] Change Early Errors for 'delete' operator to match web reality

Current browser engines do neither follow the ES5.1 nor the ES6 rules w.r.t. early errors for the delete operator. Instead they use a tighter restriction which basically prohibits any identifier (only in strict mode, of course).

That means the early error restriction should read:
It is a Syntax Error if the UnaryExpression is contained in strict code and the UnaryExpression derives an Identifier.

In general, I'm not sure why "web reality" has any relevance in a case like this where the feature was defined by the standard before there were any implementations. Just because everybody implements a specified feature incorrectly doesn't mean the spec. is incorrect.

However, in this specific case the normative ES5.1 spec. and web reality (as reported in this bug) seem to be aligned.

The normative clause in ES5.1 is 11.4.1 step 5.a (plus early error rules in clause 16). Only expressions that consist of a simple identifier reference (after eliminating unnecessary parentheses) will evaluate to a Reference value whose base is an environment record. So, in strict mode, all delete operators that reference a simple identifier are required to be reported as early errors.

In the rev 13 ES6 draft, the phrase "that statically resolves to a environment record" in the 11.4.1 early errors is redundant and I'll eliminate it.

Note also that the early errors in 11.4 concerning delete are being merged into 11.4.1. Those rules are necessary to ensure that:

delete ((((x))))

produces an early error when the rules is expressed in terms of grammar rules rather than Reference value resolution.

fixed in rev 14 editor's draft

Or it takes step 4 (in draft rev. 13) if it's an unresolvable reference... (I started to add some more bikeshedding about 11.4.1 and ch. 16, but it wasn't really worth it; the term "statically resolves to a environment record" goes away, that's what's important.)

in Rev 14 draft