"use strict 2"

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

"use strict 2"

BelleveInvis
I think that we can provide a "more strict" mode to deal with some long-lasting defects. In "more strict" mode,

  • Implicit type conversion is disabled.
  • Functions declarations are disabled. All `function(){}` are considered function literal expression.
  • Statement labels are disabled or strictly restricted.
  • A `break` statement or a "fallthrough" declaration is required to be added into the branches inside a switch statement.
  • `eval` is disabled.

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: "use strict 2"

David Bruant-5
2013/7/24 BelleveInvis <[hidden email]>
I think that we can provide a "more strict" mode to deal with some long-lasting defects. In "more strict" mode,
Why?
Who does this benefit?
You provide 5 rules. What ties them together? Why not other rules?
What would be the benefit of this new mode over additional *external* tooling (like TypeScript or JSLint/JSHint/ESLint, etc.)?

Be aware that TC39 seems to currently agree on the "1JS" idea which is pretty much not adding any new modes anymore. So you'll need to make a very strong case to change their mind :-)

David

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: "use strict 2"

Claude Pache
In reply to this post by BelleveInvis
<base href="x-msg://1633/">

I consider your first three complaints as features instead of defects, and the last one as an expert feature. The "use strict" directive corrected only objectively problematic misfeatures.

—Claude


Le 24 juil. 2013 à 11:35, BelleveInvis <[hidden email]> a écrit :

I think that we can provide a "more strict" mode to deal with some long-lasting defects. In "more strict" mode,

  • Implicit type conversion is disabled.
  • Functions declarations are disabled. All `function(){}` are considered function literal expression.
  • Statement labels are disabled or strictly restricted.
  • A `break` statement or a "fallthrough" declaration is required to be added into the branches inside a switch statement.
  • `eval` is disabled.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: "use strict 2"

Brendan Eich-3
In reply to this post by BelleveInvis
BelleveInvis wrote:
> I think that we can provide a "more strict" mode to deal with some
> long-lasting defects. In "more strict" mode,
>
>   * Implicit type conversion is disabled.
>   * Functions declarations are disabled. All `function(){}` are
>     considered function literal expression.
>

This in particular is a private fetish -- whatever floats your boat, but
nothing to put in the standard.

Function hoisting as a simplified letrec and to enable top-down program
source decomposition is a feature.

/be

>   * Statement labels are disabled or strictly restricted.
>   * A `break` statement or a "fallthrough" declaration is required to
>     be added into the branches inside a switch statement.
>   * `eval` is disabled.
>
> _______________________________________________
> es-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: "use strict 2"

Alex Russell-4
In reply to this post by BelleveInvis
This doesn't even sound as useful as "restrict mode": http://restrictmode.org/

I can sympathize with wanting more control over what to disable in the language; removing hazards is good...but it's unclear why the rules you suggest are the best ones to add under such a flag. It might be best to use something like a Traceur pass to implement the idea and get experience with how it works in practice.


On Wed, Jul 24, 2013 at 2:35 AM, BelleveInvis <[hidden email]> wrote:
I think that we can provide a "more strict" mode to deal with some long-lasting defects. In "more strict" mode,

  • Implicit type conversion is disabled.
  • Functions declarations are disabled. All `function(){}` are considered function literal expression.
  • Statement labels are disabled or strictly restricted.
  • A `break` statement or a "fallthrough" declaration is required to be added into the branches inside a switch statement.
  • `eval` is disabled.

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss