Skip to content

Instantly share code, notes, and snippets.

@MylesBorins
Last active January 22, 2018 18:59
Show Gist options
  • Save MylesBorins/78fe8ab2aec17f5a461172321d974cf3 to your computer and use it in GitHub Desktop.
Save MylesBorins/78fe8ab2aec17f5a461172321d974cf3 to your computer and use it in GitHub Desktop.
A rough history of top-level await discussion at tc39 so far
  • Nov 28th 2012
    • First mention of async / await. In relation to TypeScript
  • Jan 30 2014
  • April 10 2014
    • preview of async / await
    • includes discussion of top-level
    • reserve await
Luke Hoban (LH)
Waldemar Horwat (WH)
Mark Miller (MM)

LH: Questions about whether 'await' should be allowed at top level.  We could add to the module top level grammar, not the script grammar

WH: If it's usable in modules outside async functions, would await be a contextual keyword inside modules? It isn't right now.

MM: That would be a breaking change from ES6.

?: We could disambiguate in grammar.

WH: No. Is x = await(foo) a legacy ES6 function call or an await call?

LH: Good point, we'd need to reserve "await" in modules in ES6.
  • June 4th 2014
    • Reserve only await as a keyword in modules.
    • async and module work as contextual keywords because of their position (which can't conflict with variable names).
    • yield is reserved in strict mode, so doesn't need additional reservation.
  • July 29th 2014
    • await is a FutureReservedWord when parsing and the syntactic grammar goal symbol is Module
  • July 30th 2015
    • Advance Async Functions to Stage 2
    • in depth conversation about TLA
    • DH: No, this needs to be designed in concert with loader. Suggest decoupling to unblock async/await
  • Sept 23rd 2015
    • stage 3 approval
    • Discussion of inconsistency with require and "node's" push back on the feature
  • July 27 2016
    • top level await is invoked as an edge case to consider in regards to nested import declarations
  • July 28 2016
    • Async / Await Stage 4
@MylesBorins
Copy link
Author

My thoughts

  • Committee has taken action to ensure Top Level Await would be possible
  • Scoping it to the module goal may simplify some push back
  • It was considered that parts of the loader implementation could be dictated by this feature

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