Hopefully last word on Use Strict Directive syntax

Douglas Crockford douglas at crockford.com
Tue Jun 9 17:57:37 PDT 2009


David-Sarah Hopwood wrote:
> The rationale for using a StringLiteral ExpressionStatement as the syntax
> for a directive, is that such a statement is always useless. The above
> example is not useless code; it has a well-defined meaning, equivalent to
> 
>   "use strict" + x ? delete p : delete q;
> 
> I hope that we are not going to try to *guess* whether this code is too
> obscure for the programmer (or code generator) to have really meant it.

There is no need to guess. The person (or defective code generator) who wrote 
that code has no right to expect it to do anything useful. They should be glad 
to get the syntax error.


More information about the es5-discuss mailing list