Live data from Hacker News

Fogus: Node.js should become its own language

blog.fogus.me

1–10 of 79 posts

Re: Fogus: Node.js should become its own language

#2
I'm all for a new version of Javascript that eliminates the junk and keeps just the "Good Parts", but I'm averse to anything that serves to abstract away the bad parts by building a subset of functionality on top of the existing version javascript for a niche application (server framework in this case, other cases include cappuccino for UI, coffeescript for...everything? etc.)

The Javascript that can be used only via add-ons is not the eternal Javascript...

Re: Fogus: Node.js should become its own language

#3
"My problem with Javascript has always been that expertise is defined more in terms of understanding its faults rather than its features."

That's mostly just true for browsers. Javascript itself has very few faults.

My biggest annoyances with the language are: Lack of lexical scope, no trailing commas and semicolon usage that differs from C.

I could complain all day about my annoyances with browsers (or just IE).

Re: Fogus: Node.js should become its own language

#4
Why would you write this: [long_io_operation with callback] When you can instead write this: [long_io_operation without callback]

Off the top of my head, I'd say because "var result = long_io_operation(req);" is not only not self-documenting but actively deceptive if long_io_operation is an asynchronous call.

I'm not sure I see what's to be gained by pretending closures don't exist.

Re: Fogus: Node.js should become its own language

#8

"My problem with Javascript has always been that expertise is defined more in terms of understanding its faults rather than its features." That's mostly just true for browsers. Javascript itself has very few faults. My biggest annoyances with the language are: Lack of lexical scope, no trailing commas and semicolon usage that differs from C. I could complain all day about my annoyances with browsers (or just IE).

My most common annoyance about Javascript is the lack of bound methods like in Python Ruby etc. When you specify callbacks, you always have to provide the value of 'this' as well. If you forget, it's basically random and you're in for some heavy debugging.

Re: Fogus: Node.js should become its own language

#9

"My problem with Javascript has always been that expertise is defined more in terms of understanding its faults rather than its features." That's mostly just true for browsers. Javascript itself has very few faults. My biggest annoyances with the language are: Lack of lexical scope, no trailing commas and semicolon usage that differs from C. I could complain all day about my annoyances with browsers (or just IE).

Except that Javascript has lexical scope. Use the var keyword to define local variables.

    foo = function(){
        var bar=0
        return function(){
            bar=bar+1
            return bar
        }
    }
    baz=foo()

    baz() // => 1
    baz() // => 2
    baz() // => 3
    bar;  // => ERROR: bar is not defined

Re: Fogus: Node.js should become its own language

#10
post #9

"My problem with Javascript has always been that expertise is defined more in terms of understanding its faults rather than its features." That's mostly just true for browsers. Javascript itself has very few faults. My biggest annoyances with the language are: Lack of lexical scope, no trailing commas and semicolon usage that differs from C. I could complain all day about my annoyances with browsers (or just IE).

Except that Javascript has lexical scope. Use the var keyword to define local variables. foo = function(){ var bar=0 return function(){ bar=bar+1 return bar } } baz=foo() baz() // => 1 baz() // => 2 baz() // => 3 bar; // => ERROR: bar is not defined

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.

Post reply on HN