So strict mode is mandatory in classes and modules, and can't be turned off. Since it is mandatory, it is no longer "strict mode" like it is in perl. You can't opt out of it if you want to. Therefore all legacy constructs should be allowed there unless they are guaranteed to break the code in the future.
 
Sooner or later people will migrate their legacy code into es6 modules. We would want to make this migration as easy as possible. And saying that "02468" is fine in es3, forbidden in es6, and allowed again in es8 with *exactly the same meaning* isn't helping.
 
 
07.08.2014, 19:32, "Mark S. Miller" <[email protected]>:
The web seems unable to shed its past. In the absence of opt-in (either "use strict";, classes, or modules) legacy web code will probably be sloppy forever. In sloppy mode, you can probably use "with" forever as well.
 


On Thu, Aug 7, 2014 at 8:23 AM, Alex Kocharin <[email protected]> wrote:
 
07.08.2014, 18:51, "Mark S. Miller" <[email protected]>:
On Thu, Aug 7, 2014 at 7:08 AM, Alex Kocharin <[email protected]> wrote:

07.08.2014, 09:49, "Mathias Bynens" <[email protected]>:
> On 7 Aug 2014, at 02:46, Bill Frantz <[email protected]> wrote:
>>  On Tue, Aug 5, 2014 at 7:56 AM, Mathias Bynens <[email protected]> wrote:
>>
>>  ...
>>>  In section 11.8.3 (Numeric Literals), the definition for
>>>  `DecimalIntegerLiteral` should somehow be tweaked to match that of
>>>  `DecimalDigits`, with the exception that if the first digit is `0` and all
>>>  other digits are octal digits (0-7) it must be treated as a legacy octal
>>>  literal.
>>  So this horrible footgun, changing the value of a constant changes its radix, is only lurking in sloppy mode.
>
> It affects strict mode code too in existing implementations: there you go from not throwing on e.g. `0123456789` (which is not an octal literal because of the `8` and `9`) to suddenly throwing a syntax error when the value changes to `0` followed by only octal digits (as then it is an octal literal). See my previous posts in this thread.
Throw if value is ambiguous (i.e. `052`), don't throw if value is unambiguous (i.e. `05`, `082`). Looks good to me.

It is not compiler job to prevent bad code style, it's what linters should do.
 
It is partially the job of strict mode to prevent some egregiously confusing constructs. There is a line to draw between what strict mode prohibits and what linters warn about. But there's no one line statement of principle that captures this. Strict mode prohibits "with" and some other constructs that make it especially hard to reason about programs. 
 
 
Well, then the question is this. Is strict mode optional or mandatory to use? Will a developer always have a choice not to use it?
 
If it is optional like it is now, that's fine.
 
But if it is going to become the only es mode in the future, it should be extended as much as possible, leaving linting job to linters. Including confusing "with", because it have its uses in template engines.
 


 
--
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to