Live data from Hacker News

Node v7.5.0 Released

github.com

31–40 of 142 posts

Re: Node v7.5.0 Released

#31
post #3

There is a lot to like about Node. I had a look a couple of years ago but lack of a definitive library to handle callback hell put me off. How is the situation these days?

> lack of a definitive library to handle callback hell put me off.

1) Promises.

2) Caolan's async is wonderful for handling all sorts of 'async' problems, like async map and stuff. As close as a de facto library as you can get.

Re: Node v7.5.0 Released

#32
post #3

There is a lot to like about Node. I had a look a couple of years ago but lack of a definitive library to handle callback hell put me off. How is the situation these days?

Add --harmony flag to enable stable ES7 features (or transpile with Babel) and use async/await, it's marvellous.

Node 8.0.0 has it enabled without --harmony. Will be a great release to upgrade to.

Re: Node v7.5.0 Released

#33

It's a shame the v8 5.5 backport ( https://github.com/nodejs/node/pull/11029 ) didn't make it in but it looks like it won't be long.

Yep, should be soon, it's already going into 7.5.1 test builds https://github.com/nodejs/node/pull/11062#issuecomment-27658... Instructions are there on how to install the test build it with nvm, so you can start using it already :)

Re: Node v7.5.0 Released

#35
post #17
post #12

Earlier quoted context omitted.

There is a V8 API to expose Promises directly from native modules, and that can eventually be used to make async functions first-class citizens. async functions using promises and generators under the hood is a good thing because it allows easy usage between the two forms.

This still doesn't solve what I wrote about api, libuv (event loop + IO) that node.js use is also based on callbacks in C, last time i checked discussion about it, there was no plans to change that.

That simply won't change, because that's what node.js (and Javascript) is fundamentally about: An EventLoop, with callbacks that are used to handle events. All the promises and async/await are only sugar around callbacks, so they don't change the fundamental model.

A Go like model, with lightweight or real threads and no need for callbacks or promises will also need new synchronization mechnanisms in order to handle preemption and waiting which are currently not in scope of javascript, e.g. mutexes, condition variables, etc.

Re: Node v7.5.0 Released

#36

Earlier quoted context omitted.

You have a number of ways of keeping a handle on async code now. 1. Native ES6 promises will cover most of your basic needs. See https://developer.mozilla.org/en/docs/Web/JavaScript/Referen... . In fact, unless you have very specific needs not covered by native promises, you shouldn't drop a third party library into your project. 2. For more advanced operations on promises, use Bluebird. See http://bluebirdjs.com and…

Also highly recommend the npm async library[1] even though the hipster way is now native async/wait or promises. caolan/async has some amazing sugar on nearly every use-case the most common for me being async.auto(). [1] https://github.com/caolan/async

I highly recommend against using that library - it encourages a lot of callback hell we've found at my company, and it is much harder to create nice reusable functions with it vs. promises. bluebird is a wholly superior library for handling async flow.

Re: Node v7.5.0 Released

#37
post #3

There is a lot to like about Node. I had a look a couple of years ago but lack of a definitive library to handle callback hell put me off. How is the situation these days?

> lack of a definitive library to handle callback hell put me off. 1) Promises. 2) Caolan's async is wonderful for handling all sorts of 'async' problems, like async map and stuff. As close as a de facto library as you can get.

The standard library is still callback hell and the async package doesn't use promises at all.

Re: Node v7.5.0 Released

#38
post #3

There is a lot to like about Node. I had a look a couple of years ago but lack of a definitive library to handle callback hell put me off. How is the situation these days?

You have a number of ways of keeping a handle on async code now. 1. Native ES6 promises will cover most of your basic needs. See https://developer.mozilla.org/en/docs/Web/JavaScript/Referen... . In fact, unless you have very specific needs not covered by native promises, you shouldn't drop a third party library into your project. 2. For more advanced operations on promises, use Bluebird. See http://bluebirdjs.com and…

My understanding was that Node didn't support native ES6, is that no longer the case? Or are you talking about using a transpiler?

Re: Node v7.5.0 Released

#39

Earlier quoted context omitted.

You have a number of ways of keeping a handle on async code now. 1. Native ES6 promises will cover most of your basic needs. See https://developer.mozilla.org/en/docs/Web/JavaScript/Referen... . In fact, unless you have very specific needs not covered by native promises, you shouldn't drop a third party library into your project. 2. For more advanced operations on promises, use Bluebird. See http://bluebirdjs.com and…

My understanding was that Node didn't support native ES6, is that no longer the case? Or are you talking about using a transpiler?

Node supports all of ES2015 and ES2016 and will soon support ES2017 in the next few months or so.

So yeah, for most things you don't need to use a transpiler.

Re: Node v7.5.0 Released

#40

Earlier quoted context omitted.

You have a number of ways of keeping a handle on async code now. 1. Native ES6 promises will cover most of your basic needs. See https://developer.mozilla.org/en/docs/Web/JavaScript/Referen... . In fact, unless you have very specific needs not covered by native promises, you shouldn't drop a third party library into your project. 2. For more advanced operations on promises, use Bluebird. See http://bluebirdjs.com and…

My understanding was that Node didn't support native ES6, is that no longer the case? Or are you talking about using a transpiler?

Node has supported all of ES6 except modules since 6.0.
Post reply on HN