News for hackers. Stuff that matters.
Re:Fogus: Node.js should become its own language by udp on Tuesday April 12, 2011 @09:52AM (#2437158)
They're "hoisted" and only local to the function, though. I'd (personally) prefer it if it worked like C, and a variable was defined from the "var" statement until the next closing brace. Then you could have a variable local to one branch of an if statement, etc, without faking scopes by abusing closures (eg (function() { })(); ).

And nested loops that both use "i" would work.

Re:Fogus: Node.js should become its own language by sedachv on Tuesday April 12, 2011 @11:38AM (#2437647)
"I'd (personally) prefer it if it worked like C, and a variable was defined from the "var" statement until the next closing brace."

It does work like C. The scoping you're talking about was introduced in C99.

Re:Fogus: Node.js should become its own language by cyrus_ on Tuesday April 12, 2011 @09:32PM (#2440298)
Spidermonkey (or whatever they are calling it nowadays) supports this using the "let" keyword, fwiw.