Hacker Newsnew | comments | show | ask | jobs | submit login

I think there are a couple of async Javascript dialects that already do this:

http://tamejs.org/

The main advantage tat not many people see is that you get backwards compatibility with sync code (if statements, while loops, etc) basically for "free".




Yes, there are numerous libraries that do this. For instance, Tamejs is now rolled into CoffeeScript, creating IcedCoffeeScript. I didn't think CoffeeScript could get better, but it does.

In addition, there is:

Q (implementation of the CommonJS Promises spec) https://github.com/kriskowal/q

Streamline.js https://github.com/Sage/streamlinejs

Await.js (New, inspired by Tame/IcedCS) https://github.com/greim/await.js

jQuery.Deferred http://api.jquery.com/category/deferred-object/

...And less current libs like Node-promises and FuturesJS.

Here's a comparison from last year: http://www.infoq.com/articles/surviving-asynchronous-program...

And IcedCS's debut on HN: http://news.ycombinator.com/item?id=3522839

In JS devs seem to like to reinvent the wheel. I'd love to see the community rally around one of these solutions, instead of creating new half-finished ones and abandoning them. I'm partial to IcedCS because it's the least verbose, and it also works as a lib outside of CS. The Promises spec has been (partially) implemented by jQuery and I'm sure is here to stay.

Elm's syntax won't easily translate to any existing solution I'm aware of. It is a nice research project, but I will be sticking with established, well-tested methods instead of risking my business on another half-finished wheel.

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: