15.09.2014, 21:13, "// ravi" <ravi-li...@g8o.net>:
On Sep 15, 2014, at 1:01 PM, Alex Kocharin <a...@kocharin.ru> wrote:
 
Promises just wrap callbacks. So you had callback hell, now you have wrapped callback hell. Nice change, huh.
 
 
Actually yes, I think it is. Readable code is worth it, in my view.
 
 
Promises are really useful for a couple of things like error handling, but readability isn't one of them.
 
Quite the opposite, that ".then(...)" noise is even worse than callbacks. Try to rewrite that example with promises, I'm sure it won't be more readable.
 
I think generators are the only clean answer here. I know they aren't even in stable node, but still, they're worth recommending. Well there are fibers also, but they seem to be forgotten already.
 
 
 
 

If you want to turn async code to sync-like code, I would suggest to use generators and `co` module instead.
 
 
I am waiting for the right time to start recommending generators+X to folks asking these sort of questions. I am not comfortable yet doing so, but I agree that anyone interested should take a look.
 
—ravi
 
 

 

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/6BCCC31B-7FCD-4B20-A045-7FFAC897A53A%40g8o.net.
For more options, visit https://groups.google.com/d/optout.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/500601410802189%40web21h.yandex.ru.
For more options, visit https://groups.google.com/d/optout.

Reply via email to