News for hackers. Stuff that matters.
Re:Fogus: Node.js should become its own language by moomin on Tuesday April 12, 2011 @10:01AM (#2437197)
Don't get me wrong, this could end up being the best thing since sliced bread, but the advantage of closures is that a higher-order approach can work wonders. Just take a look at async.js.

For me, more interesting than a pure assault on callbacks would be to see if you could handle more asynchronous scenarios, using async.js as a baseline.

e.g. callback waterfall, callback when all children are finished, callback when any children are finished

Re:Fogus: Node.js should become its own language by randylahey on Tuesday April 12, 2011 @12:41PM (#2437946)
I wish this was rated higher. I don't understand the fuss about "spaghetti code". Do all those people write spaghetti code in other languages? Because I see that not as a language failing but as sloppy programming.

What's so hard about this to get a sequential execution of functions/blocks, error'ing out on the first error:

    async.waterfall(
      [ function (callback) {
          // do thing 1
          callback();
        }
      , function (callback) {
          // do thing 2
          callback();
        }
      , function (callback) {
          // do thing 3
          callback();
        }
      ]
      , function (error) {
          if (error) {
            // ohnoes errors
          }

          // all done!
        }
      );