News for hackers. Stuff that matters.
Re:Fogus: Node.js should become its own language by demallien on Tuesday April 12, 2011 @11:11AM (#2437516)
'this' is evil in Javascript. The very first line in any constructor function that I write is: var that = this;

From then on, I use 'that' instead of 'this', relying on closure magic to make things work. You never have to worry about how the function is bound thereafter.

Re:Fogus: Node.js should become its own language by wladimir on Tuesday April 12, 2011 @11:51AM (#2437716)
Thanks. I think I like that solution, as it's extremely simple. Are there any drawbacks?

CoffeeScript is cool, as it is basically "Python in JS" but I have some resistance against languages that convert to other languages. I'm not so sure why.

Re:Fogus: Node.js should become its own language by demallien on Tuesday April 12, 2011 @12:01PM (#2437771)
No, no drawbacks that I'm aware of. You're basically using a closure to bind the object to the callback, instead of using Javascript's weird 'this' binding rules, that's all...