top | item 13558118

Node v7.5.0 Released

281 points| nikolay | 9 years ago |github.com

136 comments

order
[+] omouse|9 years ago|reply
Just wanted to leave a comment about the ChangeLog which is a list of commits. It would be nice if they sat down for a day (or two) to write down proper release notes that made reference to various commits and outlined exactly what is changing, like if there are backwards compatibility issues or if there are very important bugs solved.

The changelog here looks like a git log :/ I mean, I can do better on my own projects (and have been trying to do so with node-oauth-libre) but for a major project it would be nicer if it had nice release notes.

[+] kosinus|9 years ago|reply
I actually like these release notes? The commits are an extra, and messages are always clearly worded, in my humble opinion.

I guess the commit list is the first thing that pops out when skimming, but it's less important than the notable changes.

'Notable changes' is more akin to the release notes I think you want.

As for breaking changes, Node.js follows semver. A major version lists breaking changes more clearly.

[+] koheripbal|9 years ago|reply
...even if they only did this for the top 20/50/100 changes, it would be well worth it.
[+] SeanDav|9 years ago|reply
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?
[+] GeneralMaximus|9 years ago|reply
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 http://bluebirdjs.com/docs/api-reference.html. It has a ton of features built on top of native ES6 promises. If you're using an older version of Node, it also acts as a polyfill. It can also make it easy to work with libraries that only expose a callback-based interface. So yeah, Bluebird is the shit.

3. co is a generator-based control flow library that can make your async code look more like synchronous code. It's pretty cool, but I haven't personally used it in a project, nor do I know of anyone else who uses it. It builds on top of promises and generators, and isn't very hard to understand under the hood. See https://github.com/tj/co. I wouldn't recommend it, but it might be something to play with because ...

4. ... async/await is coming to JavaScript! At a very high level, this pair of keywords is syntax sugar for what co already does as a library. This is the final stage in the evolution of taming callback hell in JavaScript, and it builds on top of everything that has come before (promises and generators). Here's a tutorial: https://blog.risingstack.com/async-await-node-js-7-nightly/

[+] MehdiHK|9 years ago|reply
We've been using async/await (transpiled with babel) for last one year in our production API code. There really is not any need to use those async control flow libraries anymore.
[+] aswerty|9 years ago|reply
The Koa web framework built by the guys behind Express is pretty neat. You can do stack like calls with it, rather than callbacks, via generator functions.

Not sure what the uptake is like but you can find more at http://koajs.com.

[+] madeofpalk|9 years ago|reply
> 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.

[+] coldtea|9 years ago|reply
These days you can use: Promises, generators and even async/await.
[+] lossolo|9 years ago|reply
Whole standard api is still using callbacks so you would need to write your wrappers around it to not use callbacks.. And async/await is not solving anything because your definitions of fuctions will still need callbacks/promises under the hood anyway (unless you use libraries that do it for you). I like how Go solves that, gorutines and you write your code as it would be normal sync code.
[+] k__|9 years ago|reply
There is also a Reactive Extensions implementation available to handle async stuff.

So if you know these from another language, RxJS is worth a try :)

[+] ausjke|9 years ago|reply
Tried with node.js for a few months and now back to php7/lavarel, node.js eco-system still evolves quickly and I need a stable backend right now, so far php7 works well for me and seems the development is faster.
[+] stymaar|9 years ago|reply
Async/await is a really wonderful addition to JavaScript !
[+] zubi|9 years ago|reply
Someone already mentioned about the co library. My personal experience is that it is excellent and massively simplifies async calls. The API resembles the async/await pattern: you use the keyword "yield" instead of "await". Async calls look as if they are sync. The code that includes heavy use of async methods such as in a database application greatly benefits from co in terms of code readability.
[+] pitaj|9 years ago|reply
The async library has been a definitive resource for years.
[+] norswap|9 years ago|reply
Many people are complaining that the standard library still uses callbacks and so even though you have async/await, you can't use it with the standard library.

I wholeheartedly agree. I don't understand why someone hasn't build a compat library that simply promisifies all the standard library (it isn't that big), taking the edge cases into account.

[+] athenot|9 years ago|reply
This is probably not the answer you're looking for, but you could look into ways that make callbacks enjoyable. The syntactic sugar provided by CoffeeScript goes a long way to make readable (and, dare I say, elegant) what would be a tangled mess in straight up JavaScript:

  # Get profiles LIST as JSON
  .post "/list", (req, res) ->
    db.maria.query getProfilesQuery, { userId: req.session.passport.user }, false
      .on "result", (result) ->
        rows = []
        res.status(200)
        result
          .on "row", (row) -> rows.push row
          .on "error", (error) -> logger.warn error
          .on "end", -> 
            res.json rows
            res.end()
5 callbacks here but they don't impede readability.
[+] kozhevnikov|9 years ago|reply
Add --harmony flag to enable stable ES7 features (or transpile with Babel) and use async/await, it's marvellous.
[+] skynode|9 years ago|reply
TypeScript async/await helps a lot with this. Type safety plus async ops. Awesomeness.
[+] lenkite|9 years ago|reply
RxJs (or equivalent FRP streams library) handles this perfectly.
[+] z3t4|9 years ago|reply
http://callbackhell.com/

I think the mental gymnastics needed to write non blocking code also makes you understand the flow of your program, witch allows good abstractions. After a while it becomes a second nature and you get a mental picture of all branches.

Thinking about code as events (button.onclick = showPicture), makes you a better programmer, as this is how a computer work. And when your program has to scale across several CPU's or servers, it will come naturally to you.

Multi threaded solutions can be easier at first, but when you need to have threads that communicate, and handle locks etc, that too becomes hard.

[+] Already__Taken|9 years ago|reply
> Use system CAs instead of using bundled ones

Does this make the npmrc config for cafile redundant now in my MITM environment? The amount of projects that just can't handle the CA or worse, a proxy setting, is very irritating.

Will we not have to make a separate config for every app that also bundles node (e.g. vscode) or anything that uses node to get a file (vue-cli, node-pre-gyp, etc)?

[+] inyorgroove|9 years ago|reply
I recently left a job that has a proxy. I would estimate the my time spent there working on proxy related issues to be more than 2 months over the 5 years I was there. Is it too unreasonable to evaluate the cost of these proxies beyond the maintenance cost?
[+] hobozilla|9 years ago|reply
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.
[+] SpencerWood|9 years ago|reply
Can't wait... need me some async await without babel.
[+] 0X1A|9 years ago|reply
I don't keep up with node end ES version compliance but is there a scheduled release that'll target all ES6 features?
[+] simlevesque|9 years ago|reply
I don't think so. They try as hard as possible. A lot of it is directly related to V8. In Node.JS v8.0.0 nightly they currently support 70% of the ES2015 spec without flags.

You can check the progress here: http://node.green/

[+] jrvidal|9 years ago|reply
Strictly speaking, tail call optimization is an ES6 feature. I had the impression that its implementation in V8 is on hold, so it might be a while.
[+] forgottenacc57|9 years ago|reply
AWS Lambda is so far behind......
[+] k__|9 years ago|reply
I don't understand
[+] crudbug|9 years ago|reply
Are there plans to add coroutines support ?