-
Notifications
You must be signed in to change notification settings - Fork 156
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
ES7 async
/await
implementation with concise syntax
#836
Conversation
226cb80
to
11d17fc
Compare
async
/await
implentation with concise syntaxasync
/await
implementation with concise syntax
How would that work with libraries using that identifier? I'm working on one that could implement this general functionality at the library level, possibly more optimally than engines could. (I'm using Bluebird-style shortcuts to do it, including keeping the stack minimized.) |
|
@vendethiel decided in #752 that lsc should not transpile ES7/ES6 |
11d17fc
to
ba94ce4
Compare
ba94ce4
to
8854954
Compare
async/await almost in v8 as stable feature. Any activity here? |
@gkz? IIRC this barely missed the V8 train for Node 7, and it's been shipping in Edge for a while. |
My opinion:
Therefore I believe it is safe for this to land in LSC. |
WRT the PR itself, I feel having both |
@summivox You mean ES8? It barely missed the ES7 train. |
@isiahmeadows It seems that people have stopped caring about the "version number" and started to rely on shipping schedule instead. I'm fine with this ;) Regarding syntax: Historically coffee-ish languages have this dilemma of symbols vs English words. |
There is a push to get rid of many of the duplicate operators like On Tue, Oct 25, 2016, 17:00 Yin Zhong [email protected] wrote: @isiahmeadows https://github.com/isiahmeadows It seems that people have Regarding syntax: Historically coffee-ish languages have this dilemma of — Reply to this email directly, view it on GitHub |
I just tested this with node v7.3.0 . It feels awesome. @isiahmeadows : I agree with you on removing |
|
Thank you for this excellent patch. I have noticed a bug when using it against the master branch ( 47ad4eb )
somehow gets compiled to (notice the superfluous yield*)
|
Thank you for the fast response! Also here's another issue. The following code compiles:
And so does this:
But the following does not:
So in the example above, |
Here's my proposed resolution: remove I'm kind of 1% tied to this project now, since the parser bugs have pretty much killed this project for me, and no stable release yet has provided ES6 support. But that's a little more meta. |
I want to remove |
8854954
to
4b9323f
Compare
see http://wiki.ecmascript.org/doku.php?id=strawman:async_functions async function: `->>`, `~>>`, `-->>`, `~~>>`, `async (arglist) ->...`, `async function name (arglist)` await: `await` => `await`; `await all` => `await*` (proposed to translate to `Promise.all`, not final) backcall does NOT work, but this should be fine because they were invented to create the illusion of async function anyway
4b9323f
to
ed71900
Compare
Hmm done. |
I fixed the issue of yield* statements being generated inside async functions due to bug #764 in gkovacs/livescript-async@97b86df (also removed |
@gkovacs could you please make a PR to my branch; thanks |
… being generated inside async functions
@yizhong-ms @summivox created a PR to your branch at https://github.com/summivox/LiveScript/pull/2/files |
removed await* which no longer exists. fix issue of yield* statements…
does this update work? tried to run examples on livescript.net with no luck. |
@determin1st This PR hasn't been merged, and livescript.net isn't updated until the next release IIRC. |
oh, i see. experimented with promises a little, found it useful but they are not "real" part of the language. it's like helpers. probably wont use this functionality. |
@rhendric Given that the ES2017 standard (with async functions) has now been released and nodejs and all major browsers support the syntax by default, is there any chance you could review and merge this pull request? Thank you! |
I would be very happy to look it over! @summivox, can you confirm that this is in a state that you endorse for merging, or if there are any outstanding issues or design questions, summarize what they are? |
@rhendric Let me quickly build and verify. I think tests need to be added. |
Yes please to tests. No rush from me (I'm actually running out the door right now and probably won't have free time for a few days anyway); just drop me a mention when you're ready for a review and I'll follow up when I'm able. Thanks! |
mark, pls add in asap |
can it use now? |
@willin If you're impatient and want to use it now do |
it will be great helpful if you add a documentation for this package. |
@gkovacs - thanks for the npm! Trying it out right now. |
#978 has landed, so I'm closing this. |
ES7 async/await is a syntax sugar for promise+generator async control pattern. Although this feature is still a draft in even ES7, it has gained considerable traction, and is completely usable right now through a babel plugin.
This patch provides a concrete example on which we can discuss syntax extensions to LiveScript that compiles to ES7 async/await.
async function
>
to all arrows:->>
,~>>
,-->>
,~~>>
Rationale for the syntax: terseness
Prepend keyword(redundant)async
to arglist of arrow functions:async (arglist) -> body
Rationale for the syntax: agrees with strawman proposal on async "ES6 rocket" functions
async
to named function definitions:async function name(arglist)
Rationale for the syntax: obvious
await
expressionawait
compiles toawait
(in the same way as howyield
is compiled now)(no longer in standard)await all
compiles toawait*
(in the same way as howyield from
is compiled now)Rationale:
await*
is proposed to have the same semantics asPromise.all
(see strawman)Example
compiles to
References