Trevor Burnham

Sure, it works in practice…

Bridging the Web

December 27th, 2009

Python is a much, much better language than JavaScriptI’ve been reading a lot about pro­gram­ming lan­guages lately. Many exciting new lan­guages have come out in recent years, and the use of multiple spe­cial­ized lan­guages within a single project has become much more common, thanks largely to the polyglot JVM and .NET plat­forms. It’s an exciting time to be a programmer.

Unless, of course, you’re pro­gram­ming user inter­faces for the web. Which everyone is.

As Jeff Atwood has said, “Every­thing that can be pro­grammed in JavaScript will be.” That’s because the browser is the most popular oper­at­ing system on the planet, and JavaScript is its lingua franca. But no one likes JavaScript. Or, more pre­cisely, no one falls in love with JavaScript the way that people fall in love with Ruby or Python or (my favorite of late) Scala.

I never fully under­stood why JavaScript was so kludgy and inel­e­gant until I read the (highly rec­om­mended) inter­view col­lec­tion Coders at Work. Long story short, one guy at Netscape (Brendan Eich) threw the language together in ten days, with the stated goals of creating some­thing seman­ti­cally Scheme–like but syn­tac­ti­cally Java-​​like. Good god!

So why are we still, 14-​​odd years later, still using the same language for all of our webapps? Because even if some backwards-​​incompatible NewScript were intro­duced, stan­dard­ized and embraced by Microsoft, Mozilla, Google and Apple tomorrow, most people would take years to update to a browser suf­fi­ciently new­fan­gled to run it. Heck, most people don’t even know what a browser is. Thus, new webapps have to be written in a half-​​baked language to be run through decade-​​old interpreters.

But there is a solution. And for all I know, Sergey Brin and Larry Page are already plotting its exe­cu­tion from their orbital bat­tlesta­tion. (Where did you think those Google Earth pics come from?) What we need is a new language for web browsers (or, better yet, a virtual machine standard that could support multiple lan­guages), along with a compiler that can generate JavaScript for the benefit of old-​​timers. The project would be insanely dif­fi­cult, but it’s half-​​done already. Look at GWT, which lets you write Java that compiles to JavaScript. Now suppose that a browser (say, Chrome 5) could run GWT’s Java bytecode directly, bypass­ing JavaScript alto­gether. Chrome 5 users would enjoy a much smoother and poten­tially richer web expe­ri­ence. Mean­while, older browsers would still present a per­fectly usable webapp. And pro­gram­mers every­where would rejoice.

That, I hope, is the future of the web. So please, Google, I urge you: Don’t let my children grow up in a world that runs on JavaScript.

Tags:     No Comments

0 responses so far ↓

Comments are closed.