Server Side JavaScript and the Universal Scripting Language
I've been using PHP more and more for not only web stuff, but also for general command line scripts as well. There's tons of functionality in all the libraries that are just super useful, and once I've used them a few times on the server, it's just easier to continue using them in scripts. The language itself, however, is pretty fugly. I mean, it's Turing complete and all that, but really could be cleaner in a lot of ways. It's not a unique thing - a lot of languages that were created for one job, and slowly expanded to encompass more functionality, like classes, etc. - eventually become sort of a mess. In PHP's case, wonky scoping rules (to me at least), tacked on language features, and generally verbose syntax makes it sort of a pain to grow projects beyond a certain point. Since most of PHP isn't actually implemented *in* PHP, like say, Java projects are, but are instead implemented in C libraries that you call out to (libxml, tidy, curl, are just a few examples of this) having the scripting part of the language be the fugly part is sort of dumb, no?
What would really be cool, in my opinion, is being able to have all the tools and libraries available in PHP, but in a system built around JavaScript. In other words I want something that works just like PHP where the heavy lifting would be done with low-level libraries, but the scripting to glue it all together would be done in JavaScript. Then your client-side programs and server-side programs could actually interact quite a bit more, rather than requiring separate libraries, tools and knowledge, etc. And like I've said before, JavaScript has an official spec, AJAX has pushed interest in the language to an all time high, and support from organizations like Mozilla and Adobe means its getting the attention and care it needs to grow, so it seems like the perfect language to do it in.
From what I've seen online, there's little pockets of effort underway to do exactly what I'm talking about. I've seen projects that add libs to use SpiderMonkey as a general scripting engine (with a FastCGI module, and libs for talking to SQLite but it's not available for Linux yet), and I've seen some effort from the Java folk to create some server-side frameworks that use Rhino. So there's definitely support for the idea, but what I'd really love to see is a major new initiative by someone like Mozilla, Sun, Adobe or whom ever to get JavaScript out of the browser to become some sort of Universal Scripting Language for the server, desktop and browser.
And JavaScript would be great not just for logic/scripting but data as well. I think the recent upsurge in the use of JSON is really interesting, and potentially super powerful. For example, I was surprised when I saw that CouchDB had implemented JSON as a first level interface to its back end data. I hadn't really thought of JSON being used that way. It's becoming a data storage/communication equivalent to many uses of XML. This means that JavaScript could become not only be a Universal Scripting Language, but also a Universal Serialization Format as well. Think about the benefits of having a single scripting language that you can use reliably on the server, in browsers, for applications (like Firefox uses it) and scripting tasks (like log file analysis or whatever), and also the same language for data encapsulation and transfer as well.
I think we're moving in that direction, already, no? I just want it to move faster!
-Russ