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

Making Iced CoffeeScript compatible with ES7 #157

Open
osyed opened this issue Jun 25, 2015 · 5 comments
Open

Making Iced CoffeeScript compatible with ES7 #157

osyed opened this issue Jun 25, 2015 · 5 comments

Comments

@osyed
Copy link

osyed commented Jun 25, 2015

Future versions of JavaScript will be providing the await/async keywords to simplify asynchronous coding.
http://code.tutsplus.com/tutorials/a-primer-on-es7-async-functions--cms-22367

So eventually await/async will be part of coffeescript. Unfortunately all the programs we've written in iced-coffeescript using the await/defer pattern will not be compatible. It would have been nice if iced-coffeescript has used the await/async pattern so that it would eventually be compatible with a future version of coffeescript.

It is possible to use the ES7 await/ascync keywords now using pre-compilers like nodent.
https://www.npmjs.com/package/nodent
So it seems the await/async features can be provided with current versions of JavaScript.

Changing iced-coffeescript to support this pattern would be a breaking change with previous versions of iced-coffeescript. It would probably need to be a top level version change or another fork of coffeescript. Perhaps the new version of iced-coffeescript would serve a very useful function of providing upcoming features of JavaScript before they make it into coffeescript.

@maxtaco
Copy link
Owner

maxtaco commented Jun 25, 2015

I prefer our semantics to ES7's, but of course don't want to be in the business of indefinitely rewriting the AST to hack coroutines. My current thought is to reimplement ICS using ES6's yield. That would significantly streamline my fork to CS, and will probably make for better performance and debuggability. More brainstorming here on that.

So probably I'll strip out CS's emission of await when ES7 comes, and stay with our semantics. That was my current thinking, at least so we can keep all of the existing ICS code that we have running properly without having to rewrite it.

@osyed
Copy link
Author

osyed commented Jun 26, 2015

I also like your semantics over ES7's. It does not require having to add the "async" keyword before every asynchronous function. Since ES7 has not been finalized yet, have you considered proposing your semantics to the spec writers. It would be super if they opted to go with await/defer instead of await/async. https://esdiscuss.org/

@maxtaco
Copy link
Owner

maxtaco commented Jun 26, 2015

Thanks @osyed, unfortunately, I am busy enough at my day job that I can't really carve out much time for this. If someone wanted to champion the cause, I'd be happy to throw in support though.

@osyed
Copy link
Author

osyed commented Jul 8, 2015

I totally understand.

I came across this meeting note on async/await got to it's current status:
https://esdiscuss.org/notes/2014-01-30#async-await

One thing I'm a bit confused about with the async/await pattern is how it deals with pre-existing asynchronous functions. For example a library or module that provides an asynchronous function. Would it require writing your own wrapper around it to add the 'async' keyword so that your wrapper can then be called with the 'await' keyword? The await/defer pattern does not have this issue and can easily handle pre-existing asynchronous functions.

@bishtawi
Copy link

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants