GithubHelp home page GithubHelp logo

Top level awaits about proposal-async-await HOT 4 CLOSED

tc39 avatar tc39 commented on May 13, 2024
Top level awaits

from proposal-async-await.

Comments (4)

domenic avatar domenic commented on May 13, 2024

We specifically reserved await at top-level in modules to account for this possibility. Nobody's had the time to really figure out the semantics yet, though.

from proposal-async-await.

ivan-kleshnin avatar ivan-kleshnin commented on May 13, 2024

Oh, cool, thank's for the response.

from proposal-async-await.

zenparsing avatar zenparsing commented on May 13, 2024

We're probably not ready for this yet, but for the record there are two solutions that make sense to me:

For server-side systems, it makes sense to me to have a main function which defines program entry. If the executed module exports a main function, then it would run that. The main function could be an async function.

Also, if we ever get do-expressions, then it would makes sense to also have a do-async-expression.

do async {
  let x = await a.doStuff(); 
  let y = await a.doOtherStuff(x);
}

My personal opinion is that we should not allow modules themselves to be async, for simplicity and separation of concerns. Also, I don't think we want to outright reject the possibility of a system which loads modules synchronously and doesn't need to worry about async within the module system itself.

from proposal-async-await.

lukehoban avatar lukehoban commented on May 13, 2024

Note that there is also quite a bit of discussion on this same topic in #9.

I'll close this issue to keep a single thread of discussion on top level await.

from proposal-async-await.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.