Is this the time for JavaScript
I was wondering if there were any decent benchmarks of the V8 Javascript engine and I found this:
http://shootout.alioth.debian.org/u32/javascript.php Does this mean Javascript is one of the baskets we should put our eggs in, now that Apache has left the JCP and we don't know what Oracle has in store for Java ? I've been toying with the idea of having a stateful web framework written in Javascript. Imagine Lift but written in Javascript.A view first approach where the snippets use jQuery selectors to bind to the XHTML nodes and where the framework "magically" divides the function calls into server/client code (it's all javascript isn't it). Wouldn't it be nice to be able to do:
function myForm() {
$("#button").onclick = function () {
alert("You clicked on a button ... now i'll work my magic ;)"); // This is client side stuff so it goes with the final page
// Here we must create a server call
fs.readFile('/etc/passwd', function (err, data) {
if (!err)
$("#result").append(data); // And back to the client
});
}
}
If you look at Lift they're pretty close to this but they use a JavaScript DSL which I'm not really fond of. I really think this could be pulled off and what I feel is the best thing about the concept is the "magical" division of server/client code.
We could make it explicit initially but it should be like a JIT for the web where the optimizations are done in runtime with clever distribution of the load between the server and its clients.