3 ms·
> use real pragma syntax, which will fail in old user agents > We shall see how this experiment works, but in no way is it like `"use stricter";`. I might be
by matt_kantor 12y ago
> use real pragma syntax, which will fail in old user agents
> We shall see how this experiment works, but in no way is it like `"use stricter";`.
I might be misunderstanding your comment, but stupidcar's link (http://www.2ality.com/2015/02/soundscript.html http://www.2ality.com/2015/02/soundscript.html) mentions `"use stricter;"` and `"use stricter+types;"` as mode flags, although it also contains a big disclaimer ("The final version of SoundScript may look and work completely different").
Has the syntax been changed since February? If so, I'm interested in reading about it (but my Google-fu is failing); got a link?
- BrendanEich 12y agoThat talk on which Axel Rauschmayer reported had some info from a presentation given by Andreas Rossberg of the V8 team to the last TC39 meeting. Here's the PDF: http://www.mpi-sws.org/~rossberg/papers/JSExperimentalDirections.pdf http://www.mpi-sws.org/~rossberg/papers/JSExperimentalDirect... There are two ideas: 1. A `"use stricter";` (originally "use sanity" :-/) prologue directive that would not change runtime semantics for code that passed all of static checks, (control flow dependent) dynamic exception-throwing tests, and runtime restrictions on object behavior. 2. A "SoundScript" mode, perhaps enabled by a `use types;` opt-in, or expressed some other way (per module?), that enables gradual type checking based on optional annotations inspired by TypeScript, but with TS-incompatible differences. Mode 1 might fly with TC39, because it does not fork semantics for code that passes all checks. But for real-world code, there will be divergence when run on old vs. new browsers, so I expect push-back in TC39 on this mode being expressed by a useless string expression statement. Mode 2 cannot be enabled by a fake-string-expression-statement "prologue directive".
- matt_kantor 12y agoThanks! This looks promising. Gradual typing is something I've been wanting in JavaScript ever since ES4 got my hopes up.