Skip to content
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

Design Meeting Notes, 3/10/2023 #53198

Closed
DanielRosenwasser opened this issue Mar 10, 2023 · 9 comments
Closed

Design Meeting Notes, 3/10/2023 #53198

DanielRosenwasser opened this issue Mar 10, 2023 · 9 comments
Labels
Design Notes Notes from our design meetings

Comments

@DanielRosenwasser
Copy link
Member

Parsing Octal Literals and Escapes

#51837

// allowed outside of strict mode
function loose() {
    // numeric octal
    console.log(0170);

    // octal string escapes
    console.log("\170");
    console.log("\0170");
}

// errors in strict mode
function strict() {
    "use strict";

    // numeric octal
    "use strict"; console.log(0170);

    // octal string escape
    "use strict"; console.log("\170");
    "use strict"; console.log("\0170");
}

function errorsAlways() {
    // octal template string escapes
    console.log(`\170`);
    console.log(`\0170`);
}

// valid ALWAYS
function validAlways() {
    // explicit octal
    console.log(0o170);

    // not even an octal string escape sequence
    console.log("\0o170");

    // Tagged Template Strings
    console.log(String.raw `\170`);
    console.log(String.raw `\0170`);
}

4.9 Playground
PR Build

  • In JS, octal numeric literals have a leading zero
    • It is an error to use this in strict mode
  • Octals also exist in string escape sequences
    • Don't need a leading zero(!)
    • It is an error to use this in strict mode
  • Octals also exist in template strings
    • It is an error to use this in any mode
  • You may write 0o170 in any mode
  • "\0o170" is not a string escape sequence, though.
  • You may write String.raw`\170` and get the string "slash one seven zero"
  • TS currently fails to error on \170 in strict mode.
  • This PR fixes this, but also treats octals in sloppy-mode is if they were in strict mode.
  • Does anyone want to stand up for sloppy mode?
    • No.
  • Think this is technically Annex B, so we can claim your engine technically might not support this.
  • Steelman case: Someone using TS for JS-only tooling purposes?
    • Probably rare, and parse errors can be ignored.
  • Saves some performance.
  • Conclusion: Ship it!

Testing Node 12.20

#53194

  • Made it so 5.0 says Node 12 is a minimum (even though we work on lower than that right now).
  • But Node 12 is old.
  • Our infra can't use stuff like ?? and ?. if we have to test on Node 12.
  • Also, stable sort is only mandated in ES2019 (so questionable if Node 12 can "guarantee" that even if it always has)
  • Could we say "TypeScript 5.x will always support Node 12?"
    • That's going to be 2.5 years! Node 12 doesn't even get security updates anymore, does it?
    • Node 12 goes out of maintenance in April.
    • TypeScript 5.1 goes out just after that - doesn't make sense to support.
  • Conclusion: should say Node 14 is what's supported in 5.1, so don't add a test runner we'd have to rip out immediately.
@DanielRosenwasser DanielRosenwasser added the Design Notes Notes from our design meetings label Mar 10, 2023
@fatcerberus
Copy link

fatcerberus commented Mar 10, 2023

Wait, I could have sworn 0oXXX style octals weren't introduced until ES6 (or possibly later)... weird that 0XXX is disallowed in strict mode since that breaks any ES5 strict-mode code that uses them

@fatcerberus
Copy link

Off-topic but I really don't like V8's error message for this:

> function foo() { 'use strict'; 042; }
function foo() { 'use strict'; 042; }
                               ^^^

Uncaught SyntaxError: Octal literals are not allowed in strict mode.

0o42 is allowed so I guess that doesn't count as an octal literal 😉

@RyanCavanaugh
Copy link
Member

I looked it up so I'll post it: The spec calls 017 a "LegacyOctalIntegerLiteral" and 0o17 an "OctalIntegerLiteral"

@RyanCavanaugh
Copy link
Member

Also: octal integer literals allow separators!!

const oOoOo = 0O0_0_0_0;

@jakebailey
Copy link
Member

Note discrepancy: Node 12 went EOL last April, it's Node 14 that's going EOL this April.

@fatcerberus
Copy link

Hmm, so by the same argument made in the notes, TS 5.1 should have a minimum target of node 16 😉

@jakebailey
Copy link
Member

My recollection was that I basically said "TS is more conservative than most projects, so people are likely to have hit other things breaking earlier", but, I do think that we should try and not break the previous EOL version when possible because there really always are people stuck just one version behind.

Once Node 14 is EOL, there should truly be no reason to be using Node 12.

@graphemecluster
Copy link
Contributor

Thank you for bring this to the design meeting — I've just updated the PR. 🎉🚀

@HolgerJeromin
Copy link
Contributor

Just wanted to add that this breaks VS2019 support with a suggested fix to hack in the registry...

#54686

I have no idea who could update EOL node in VS2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design Notes Notes from our design meetings
Projects
None yet
Development

No branches or pull requests

6 participants