github at esdiscuss.org (2013-07-12T02:26:56.931Z)
Just to clarify about the `map[undefined]` example. Yes I'm talking about the
regular object `var foo = {}`, I know this is a minor detail, but I assume
that whenever `undefined` is set as a key (both for insertion and
retrieval). It's most likely because something wrong happened. I can't
imagine a logic that depends on setting `foo[undefined] = 'something'`. And
the developer should be warned about it either with a thrown runtime error
or with a console warning.
Thanks for the references, that pretty much clarifies what I had in mind.
Just to clarify about the map[undefined] example. Yes I'm talking about the regular object 'var foo = {}', I know this is a minor detail, but I assume that whenever 'undefined' is set as a key (both for insertion and retrieval). It's most likely because something wrong happened. I can't imagine a logic that depends on setting foo[undefined] = 'something'. And the developer should be warned about it either with a thrown runtime error or with a console warning. Thanks for the references, that pretty much clarifies what I had in mind. On Tue, Apr 16, 2013 at 11:12 AM, David Bruant <bruant.d at gmail.com> wrote: > >> 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 >> community. >> >> >> - 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. >> >> David >> >> [1] https://mail.mozilla.org/**pipermail/es-discuss/2011-** >> December/019112.html<https://mail.mozilla.org/pipermail/es-discuss/2011-December/019112.html> >> [2] https://brendaneich.com/2012/**04/the-infernal-semicolon/<https://brendaneich.com/2012/04/the-infernal-semicolon/> >> [3] http://restrictmode.org/ >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130416/5b5b9d85/attachment.html>