Live data from Hacker News

RQ – A small JavaScript library for managing asychronicity

rq.crockford.com

31–37 of 37 posts

Re: RQ – A small JavaScript library for managing asychronicity

#31
post #30

It is kind of nasty to break your code into basic blocks, and tie them using library functions. This will certainly not make things much cleaner! I was hoping one day Javascript could support "deep" coroutines, so we can keep on programming "sequentially" as we did before while still using asynchronous mechanisms. Perhaps there exist languages that compile to Javascript, that offer deep coroutines (?)

pogoscript.org has some nice features to let you use async like it was sync.

  fs = require 'fs'
  mojo = fs.readFile 'mojo.txt' 'utf-8' ^!
  console.log (mojo)
(note that if readFile returned a promise you wouldn't need to use the ^)

Re: RQ – A small JavaScript library for managing asychronicity

#32
post #30

It is kind of nasty to break your code into basic blocks, and tie them using library functions. This will certainly not make things much cleaner! I was hoping one day Javascript could support "deep" coroutines, so we can keep on programming "sequentially" as we did before while still using asynchronous mechanisms. Perhaps there exist languages that compile to Javascript, that offer deep coroutines (?)

ES7 async/await functions? https://github.com/jaydson/es7-async

Babel already enables them.

Re: RQ – A small JavaScript library for managing asychronicity

#33
post #17

Must be frustrating for Crockford to be in TC39. He didn't like class keyword, thought typing (TypeScript etc) is a wrong direction. This (albeit it began 2013, but it was just updated) library does not mention ES6 Promises, proposal for async await, or the yield hack.

Crockford is no longer in TC39 and hasn't attended for quite some time now (maybe a year).

Re: RQ – A small JavaScript library for managing asychronicity

#34
post #24

Earlier quoted context omitted.

I'm more interested in these sorts of features being in the ES6 Promises implementation. I expect that given a lot of new Web APIs are going to be using the native promises, these features being in the ECMAScript promises implementation is pretty important.

For good or ill, it's not going to happen. ES6 is meant to have a VERY small promises API (although you can use a library like Bluebird as a wrapper around the native implementation to provide a better API). A more full features promises API will be coming in ES7. See, for example, the discussion about adding a .any() method to the ES6 promise spec: https://esdiscuss.org/topic/promise-any The conclusion basically tha…

The good news is ES7 is actually named ES2016, and will come out in one year.

The bad news is nobody has actually stepped up to champion such an addition, so it's looking unlikely that such a feature would be implemented in 2 browsers by the mid-2016 deadline necessary for it to be part of ES2016.

Re: RQ – A small JavaScript library for managing asychronicity

#35
post #24

Earlier quoted context omitted.

For good or ill, it's not going to happen. ES6 is meant to have a VERY small promises API (although you can use a library like Bluebird as a wrapper around the native implementation to provide a better API). A more full features promises API will be coming in ES7. See, for example, the discussion about adding a .any() method to the ES6 promise spec: https://esdiscuss.org/topic/promise-any The conclusion basically tha…

The good news is ES7 is actually named ES2016, and will come out in one year. The bad news is nobody has actually stepped up to champion such an addition, so it's looking unlikely that such a feature would be implemented in 2 browsers by the mid-2016 deadline necessary for it to be part of ES2016.

ES2016? As far as I knew, the ES7 name was being kept, but the ECMAScript script would be updated yearly, as opposed to the 5 or 6 years between ES5 and ES6.

Re: RQ – A small JavaScript library for managing asychronicity

#36
post #24

Earlier quoted context omitted.

I'm more interested in these sorts of features being in the ES6 Promises implementation. I expect that given a lot of new Web APIs are going to be using the native promises, these features being in the ECMAScript promises implementation is pretty important.

For good or ill, it's not going to happen. ES6 is meant to have a VERY small promises API (although you can use a library like Bluebird as a wrapper around the native implementation to provide a better API). A more full features promises API will be coming in ES7. See, for example, the discussion about adding a .any() method to the ES6 promise spec: https://esdiscuss.org/topic/promise-any The conclusion basically tha…

Well ES6 is so far down the editing path that any additions now are pretty much impossible, but with ES7 coming about a year after ES6 it wouldn't be a long wait for a bigger Promises API to end up in the ECMAScript spec.

Re: RQ – A small JavaScript library for managing asychronicity

#37

Earlier quoted context omitted.

I'm more interested in these sorts of features being in the ES6 Promises implementation. I expect that given a lot of new Web APIs are going to be using the native promises, these features being in the ECMAScript promises implementation is pretty important.

It doesn't matter at all what kind of promise flavor an API returns because promise implementations treat other implementations as interchangeable. Even the ES6 Promises implementation supports this: Promise.all([{ then: function(r) { r(3); } }]).then(function(result) { console.log(result); }); Here the plain object with then could have been any promise implementation, even jQuery, and it still works.

I do understand that, but it'd be very nice to be able to do some things like timeouts and the like, without loading quite a few kilobytes of another promise implementation.
Post reply on HN