Stricter "use strict"

David Bruant bruant.d at
Tue Apr 16 02:12:37 PDT 2013

Hi Francisco,

TC39 (which I'm not part of) agreed to not add more modes to ECMAScript. 
They try to follow the "1JS" rule, that is there is only one language. 
Among other things, this makes writing parsers and interpreters easier. 
I think this all started at [1] (you don't need to read everything, but 
it gives an idea).
Strict mode was necessary to fix big flaws of the language that needed 
to be fixed and couldn't be without a mode, but that's as far as it 
went. Based on the examples you gave, it seems you haven't pointed at 
major language flaws that justify a new mode. More on that inline.

Le 16/04/2013 10:28, Francisco Ferreira a écrit :
> Stuff that pops my mind that "use strict" doesn't cover and that could 
> be useful is:
> "use stricter";
>  - Enforces the use of ';' at the end of a line of code
Be careful, this can be a sensitive topic for some people and may end up 
with flames :-) On that topic, I highly recommend Brendan Eich's article 
[2] which among other things summarizes a drama that animated the JS 

>  - Either force the usage of '===' instead of '==' or make '==' more 
> type safe.
You might be interested in restrict mode [3]

>  - Makes map[undefined] break or throw a warning
By "map", i assume you're referring to a regular object and not an ES6 
map. What do you mean by "break" and "throw a warning"? Do you want a 
runtime error to be thrown or this error to be caught by devtools?

As a developer, one thing you can do is at least build a tool (like 
restrict mode) and add git/mercurial/svn per-commit hook to enforce that 
your 2 first points are enforced. This way, when you and your team write 
JavaScript, you can be guaranteed that semicolons are in and that no one 
uses ==. I don't fully understand your 3rd point so I'm not sure a tool 
can catch that, but my point is that by building tools yourself, you can 
enforce the sublanguage of your choice in your projects.



More information about the es-discuss mailing list