News for hackers. Stuff that matters.
Re:Node v4.0.0 by danneu on Tuesday September 08, 2015 @06:56PM (#10188672)
Using abstractions like http://koajs.com/ and https://github.com/tj/co make Node code feel like every other language.

    var user;
    try {
      user = yield db.insertUser('foo')
    } catch(err) {
      if (err.code === '23505') {
        this.flash['error'] = 'Username taken';
        this.redirect('/register');
        return;
      }
      throw err;
    }
Re:Node v4.0.0 by aikah on Tuesday September 08, 2015 @10:06PM (#10189274)
no because you can't write a library which apis are thunks. And your code needs to run in a generator, something you omitted. Fibers are a better alternative , no need for yield and generators everywhere.
Re:Node v4.0.0 by danneu on Wednesday September 09, 2015 @12:25PM (#10192356)
Well, I was earnestly sharing run-of-the-mill Koa code since you made async abstractions sound elusive. Didn't realize you just had an agenda.

The thing is that people are actually using Koa/co to solve this problem. I've yet to see someone use fibers as their core webapp control flow abstraction.

Re:Node v4.0.0 by aikah on Wednesday September 09, 2015 @12:54PM (#10192552)
What agenda do I have ? I have none, I'm just saying using generators do not abstract async calls. The only way to do that is by using fibers. I'm not pushing for anything, i'm just saying that something like rails couldn't be written in nodejs , (and no sails , is nothing like rails in terms of complexity ).
Re:Node v4.0.0 by danneu on Wednesday September 09, 2015 @09:54PM (#10195787)
It's your fiber agenda. My mother used it to try to make me eat my brussels sprouts and I thwarted that, too.