7 ms·
It was originally `use strict` without any quotes, along with other possible `use ...` statements in the scrapped ES4 working draft. It seems that the exact per
by lifthrasiir 3y ago
It was originally `use strict` without any quotes, along with other possible `use ...` statements in the scrapped ES4 working draft. It seems that the exact person suggested this particular syntax was David-Sarah Hopwood [1], which suggestion was quickly adopted to the next draft of what eventually became ES5.
[1] https://web.archive.org/web/20150525070848/https://mail.mozilla.org/pipermail/es5-discuss/2009-May/002591.html https://web.archive.org/web/20150525070848/https://mail.mozi...
- jraph 3y agoIt was good that it's a string literal, so it did not make the file incompatible with parsers that didn't support strict mode. You'd have to make sure your code behaved correctly both in sloppy mode and in strict mode. Probably irrelevant today.
- lifthrasiir 3y agoThat indeed was a big concern, and the initial proposal assumed that it at least has to survive the lexical analysis. At some point there were two syntaxes, `use strict` (optionally followed by a comma and other tokens) or `if (false) use(strict)` at one's choice. In comparison Hopwood's proposal was not even an actual proposal but quickly adopted due to its simplicity and robustness. The only complaint was a space in the literal.