Node v6.6.0
nodejs.org
nodejs.org
Now using node v6.6.0 (npm v3.10.3)
$ node
> Promise.reject()
Promise { <rejected> undefined }
> (node:85928) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): undefined
Forgetting to handle rejection is probably the most common error I see when people post Promise snippets in #node.js. Silent failure is so deadly. "Why do my requests hang?"
Though it does emit another message when rejection is handled asynchronously.
> var p = new Promise((_, reject) => reject('lol')) \
setTimeout(() => p.catch(() => console.log('handled')), 0)
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): lol
PromiseRejectionHandledWarning: Rejection handled asynchronously (rejection id: 5)
Consolation prize?Fortunately, most of the run of the mill promises I can think of off the top of my head get rejection handlers attached synchronously, like in upstream middleware. I might be drawing a blank, though.
I don't mind that it also emits a warning, but AFAIK you could already get that information by subscribing to this more specific event?
[0] https://nodejs.org/dist/latest-v6.x/docs/api/process.html#pr...
Try running the following script with v5.12.0 and again with v6.6.0:
https://gist.github.com/michaelsbradleyjr/d1b104137e8e00468d...
node --version && node --use_strict ./mutrec_vs_tramp_vs_gen.jsThat is great to hear. Now we can finally start really doing functional programming in JS. Too bad about the generators, though.
Can't remember where I heard this, but I'm given to understand they aren't optimized, just allowed. As in, recursive calls from tail position won't be super-fast or anything, they just won't blow out the call stack. Optimization may or may not be added to the engine at some future date.
go: http://lethalman.blogspot.it/2015/02/developing-in-golang-wi...
haskell: https://ocharles.org.uk/blog/posts/2014-02-04-how-i-develop-...
python: http://datakurre.pandala.org/2015/10/nix-for-python-develope...
node.js: http://sandervanderburg.blogspot.it/2014/10/deploying-npm-pa...
I recommend reading Luca Bruno's blog for learning Nix internals and more advanced topics.
The real problem is that creating a good intro developer experience takes sustained skilled time. I'm right now working on a similar project at GoCardless and we've got 3 engineers and a designer focused almost full-time on writing, designing, and user-testing our API tutorial. The Conda community would either have a patreon to sponsor someone to work on it, or convince a company to do that.
$ nvm install 6.6.0
Downloading https://nodejs.org/dist/v6.6.0/node-v6.6.0-darwin-x64.tar.xz...
######################################################################## 100.0%
Now using node v6.6.0 (npm v3.10.3)
$ node -v
v6.6.0That said, I use `n` because for some reason `nvm` makes my shell take more than a second to startup (I've tried tons of fixes and none work).
First, put the version you commonly use in your path
export PATH="${PATH}:/home/victor/.nvm/versions/node/v6.5.0/bin"
Then, instead of sourching nvm when your shell starts, do it when you call an alias instead. export NVM_DIR="/home/victor/.nvm"
alias n=". $NVM_DIR/nvm.sh"
Now, you have a node+npm version by default, and you can do a quick flow if you want to change $ n
$ nvm install 6.6.0
Now using node v6.5.0 NODE_PATH=$(dirname ~/.nvm/versions/node/v6*/bin/node)
export PATH="\
${NODE_PATH}:\
...
export NVM_DIR="/Users/jbergstroem/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
Also, the delay that a lot of you may be experiencing has to do with npm, not nvm. nvm reinstall-packages v6.5.0
to reinstall all your global packages from v6.5.0 or other versions.