New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "use strong"; prologue #5010

weswigham opened this Issue Sep 29, 2015 · 5 comments


None yet
5 participants

weswigham commented Sep 29, 2015

v8 (and node 4) have an in-progress implementation of the proposed use strong mode. According to this presentation there are plans to make a formal proposal to the ECMA at some time in the future, but given that both chrome and node already implement much of it (albeit behind a flag) it could be used/useful already. Minimally, we could start by recognizing the "use strong" prologue as a form of "use strict".

@mhegazy mhegazy added the Suggestion label Sep 29, 2015


This comment has been minimized.


kitsonk commented Oct 1, 2015

For those who don't want to dig through the presentation, outside of run-time enforcement of typings (in the TypeScript style) strong mode enforces the following:

  • Remove support for var, instead let or const would be used.
  • No undeclared variables
  • No use before declaration, except for recursive function calls.
  • Accessing missing properties throws
  • Objects created in strong mode are not extensible
  • Non-configurable properties cannot be frozen
  • class prototypes are frozen
  • class instances are sealed
  • methods require proper instances
  • Array are non-sparse
  • arguments is eliminated (use ...args)
  • calling with too few arguments throws (use optional args)
  • No implicit coercion (except toBoolean)
  • == and != require compatible typeof

There is a lot more on the "StrongScript" typing that the presentation doesn't make fully clear. I also haven't (yet) tried to see what they have built so far. There is clearly some parts of the second part of the proposal, around typing that wouldn't be fully compatible with TypeScript (for example they have nominal classes for structural typing, they allow explicit typing of this, etc.)


This comment has been minimized.


weswigham commented Oct 1, 2015

The typing parts of their proposal are a separate "SoundScript" extension and are proposed to be used with the prologue "use strong+types";. For now, that part seems a longer way off than the simple strong mode semantic changes, so I don't think we need to worry about it yet. For a minimum amount of work, "use strong "; is supposed to include all use strict restrictions, so we could begin by recognizing it as a form of the use strict prologue.


This comment has been minimized.


This comment has been minimized.


ivogabe commented Oct 8, 2015

+1 on this one. The emit must change in some situations, for example an enum should use a const instead of a variable and (if I understand correctly) the whole enum should be written as one big object literal. Helper functions should be written using a const (or let) too and I'm not yet sure if decorators can be used.


This comment has been minimized.


weswigham commented Feb 23, 2016

Strong mode is dead, so we don't need to worry about supporting it. Though I'd still keep an eye on what their type annotation plans are.

@mhegazy mhegazy closed this Feb 23, 2016

@Microsoft Microsoft locked and limited conversation to collaborators Jun 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.