Live data from Hacker News

Fogus: Node.js should become its own language

blog.fogus.me

31–40 of 79 posts

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

#31

As someone who has spent the last six months coding in Node.js, I completely disagree with this notion. One of my favorite advantages of Node is in fact that it is based on javascript. When building my application I can share code between client/sever side (string formatting methods for example) and don't need to do any mental context switching when it comes to languages. I've developed in javascript for years and al…

I think the fundamental objection fogus has is that the language does not support the programming model. For example, I can program object-orientedly in C, but that language does not help me do it. I have to do much of the work myself. So you can program in JavaScript in an event-based way using Node.js, but JavaScript itself does not help you much in doing so. It requires that you do most of the work yourself - work that is mechanical, and basically requires that you be a human compiler.

Disclaimer: I don't program in JavaScript or Node.js. So I'm talking from conceptual understanding, not experience.

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

#32
Not sure why he uses this as a code sample, as it's also not how someone would write code (though I suppose he is entitled to his style).

The original from the article

  function do_request(req) {
    return long_io_operation(
    req, 
    callback=function(results) {
      return create_something_from(results);
    });
  }
How it might be written if you saw it in a codebase

  function do_request(req, callback) {
    long_io_operation(req, function(err, results) {
      callback(err, create_something_from(results));
    });
  }
It seems like the article is not finished, so I can understand that there might be questionable sections. Also you'll note that he forgot the `error, results` argument pattern for callbacks, making me think that he is not terribly familiar with node.

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

#34
post #31

As someone who has spent the last six months coding in Node.js, I completely disagree with this notion. One of my favorite advantages of Node is in fact that it is based on javascript. When building my application I can share code between client/sever side (string formatting methods for example) and don't need to do any mental context switching when it comes to languages. I've developed in javascript for years and al…

I think the fundamental objection fogus has is that the language does not support the programming model. For example, I can program object-orientedly in C, but that language does not help me do it. I have to do much of the work myself. So you can program in JavaScript in an event-based way using Node.js, but JavaScript itself does not help you much in doing so. It requires that you do most of the work yourself - work…

It requires that you do most of the work yourself - work that is mechanical, and basically requires that you be a human compiler.

It would be a good idea to write some JavaScript before you make statements like these with so much conviction.

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

#35
post #11

I prefer coffee-script. It also works in the browser. http://jashkenas.github.com/coffee-script/

The good news for fogus is that everyone who prefers CoffeeScript validates the idea that an alternative syntax is enough of a win to be worth the adoption headaches.

But whatever he is after have to be much more lucrative than writing coffeescript.

Apart from pleasant syntax, coffeescript also improves upon semantics where it can - this binding, lexical scoping etc etc. People are willing to adopt Coffeescript because it compiles to javascript, it has improved semantics and clean & mostly familiar syntax.

To sum it up, the inertia is small when moving from JS to cofffeescript. That doesn't look like the case with funode.

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

#36
post #34
post #31

Earlier quoted context omitted.

I think the fundamental objection fogus has is that the language does not support the programming model. For example, I can program object-orientedly in C, but that language does not help me do it. I have to do much of the work myself. So you can program in JavaScript in an event-based way using Node.js, but JavaScript itself does not help you much in doing so. It requires that you do most of the work yourself - work…

It requires that you do most of the work yourself - work that is mechanical, and basically requires that you be a human compiler. It would be a good idea to write some JavaScript before you make statements like these with so much conviction.

Fair enough, but the examples I've seen look like continuation passing style (http://en.wikipedia.org/wiki/Continuation-passing_style), which is something we know how to abstract behind language syntax and semantics. In what way am I wrong?

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

#37

"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).

    Javascript itself has very few faults.
We disagree.

Signed,

Douglas Crockford, Jeremy Ashkenas, and Brendan Eich

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

#38
post #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.

'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

#39

As someone who has spent the last six months coding in Node.js, I completely disagree with this notion. One of my favorite advantages of Node is in fact that it is based on javascript. When building my application I can share code between client/sever side (string formatting methods for example) and don't need to do any mental context switching when it comes to languages. I've developed in javascript for years and al…

"The "faults" of javascript are primarily inexperience with event looped architectures that use callbacks"

Maybe for a lot of people this is true, but for me the faults of javascript are ingrained language "features". Actually, I'm not the only one who thinks so, because theres a website dedicated to it[1].

[1] http://wtfjs.com/

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

#40
post #36
post #34

Earlier quoted context omitted.

It requires that you do most of the work yourself - work that is mechanical, and basically requires that you be a human compiler. It would be a good idea to write some JavaScript before you make statements like these with so much conviction.

Fair enough, but the examples I've seen look like continuation passing style ( http://en.wikipedia.org/wiki/Continuation-passing_style ), which is something we know how to abstract behind language syntax and semantics. In what way am I wrong?

Programming in an "event-based way" is a huge part of writing traditional JavaScript in the browser. You're handling user events, Ajax responses, the page load itself. And JavaScript's first-class functions and closures are extremely well-suited to the task.
Post reply on HN