Live data from Hacker News

JavaScript: It’s Not Just for Browsers Any More

pragprog.com

1–10 of 93 posts

Re: JavaScript: It’s Not Just for Browsers Any More

#2
This is a couple months late but nails it. NodeJS was the spark to the powderkeg.

  > During development, one small, yet important, feature that Node lacks is the
  > ability to auto-restart when a change is made to the server’s source code.
Hm...sounds like a good application for Node's file-watching capability, so I don't see why this needs to be built-in. Start your app indirectly with a script that monitors the source files.

Re: JavaScript: It’s Not Just for Browsers Any More

#6
post #3

Strangely enough, Netscape Corporation once marketed javascript as a lightweight server-side language. IIRC the browser-side javascript thing was an afterthought.

You are right that Netscape used JavaScript as a lightweight server-side language. However my memory from the times is that JavaScript was invented for the browser and then ported to the server.

Re: JavaScript: It’s Not Just for Browsers Any More

#7
post #5

Why do we want javascript on the server side, when we already have so many other options? I'm not trying to imply something against this aproach, this really is a question.

It's a nice clean language that fits the event-driven paradigm better than most. When every function is an automatic closure, things are much easier.

Re: JavaScript: It’s Not Just for Browsers Any More

#8
post #5

Why do we want javascript on the server side, when we already have so many other options? I'm not trying to imply something against this aproach, this really is a question.

Because it's actually a decent language when you take away the DOM cruft?

It's actually remarkably similar to Scheme [1] with very flexible arrays and real first-class functions.

[1] http://www.crockford.com/javascript/little.html

Re: JavaScript: It’s Not Just for Browsers Any More

#9
post #5

Why do we want javascript on the server side, when we already have so many other options? I'm not trying to imply something against this aproach, this really is a question.

I'm excited about this idea because:

1) This approach lets me put together a quick server without a big, complex container to configure (No Apache, Tomcat, Rails, (Insert Python Framework Here), etc).

2) Javascript really is a nice language to program in. First class functions lead to some neat tricks, and aside from a few minor quirks (scoping issues, overloading the "+" operator) it lacks nasty gotchas like Java and PHP, at least so far.

3) Lots of programmers have JS experience and web experience, so there's a large potential pool of users (Subjectively, this may or may not be a good thing, see PHP. But there's demand)

It's probably not the be-all-end-all, but there are some positive reasons to see work in this space. I'm curious to see how the language implementations evolve as people start doing more complex server side things with JS.

Re: JavaScript: It’s Not Just for Browsers Any More

#10
post #4

Hot code loading in NodeJS has been implemented many times, see e.g.: http://romeda.org/blog/2010/01/hot-code-loading-in-nodejs.ht...

Thanks for the link. I think, though, auto-restart is a nice little feature that's important enough that it should be baked-in by default. I just take it for granted that's it already there in other frameworks.
Post reply on HN