Wednesday, July 28, 2004

Rich Browser Apps and Language Bigotry

Folks are talking about browser-based rich clients again and making interesting predictions on the future of application GUI's. I had long ago written off technologies like DHTML and JavaScript as just ugly UI hacks meant for silly animation and annoying popups, but it's now time for another look.

Especially with a second look at JavaScript, I'm very pleasantly surprised.

Yes, that's coming from someone who had written off JavaScript as a just a toy.

Let me catalog my inbred language bigotries. I'm an old Lisp hack -- learned it way back in high school. Then delved into C and Tcl. Then C++ (argh, including early Component Object Model, early CORBA) and Java. Most recently, I've used Python/Jython. And, I have sworn off XSL - terrible write-once stuff. I have fond memories of the very high productivity of the Lisp days with its function-oriented interpreted model. Long live the late-bound read-eval-print loop for productivity.

On JavaScript, I had no idea it had the following interesting features:

For Lisp folk:
  • first class anonymous functions
  • lexical closures
  • eval and uneval
For folks who can't stand Lisp syntax:

  • a loosely-typed Java-like syntax (ok, this I knew already)
  • simple list syntax, like ["hello", "world", "in", 2004]
  • simple associative array syntax, like { republican: "Bush", democrat: "Kerry" }
  • objects are associative arrays, like { firstname: "Conan", lastname: "The Republican" }
  • variable length arguments (varargs)
  • built-in regular expression support
  • private, protected, and public methods and fields
  • prototype based language features. I did not understand prototypes until, oh, last month, and I am starting to believe they are more flexible and powerful than C++/Java-style OO.
In short, JavaScript is a dialect of Lisp (Scheme?) with a Java-like syntax that most folks can live with. And, it has lots of surprisingly powerful "duck typing" features.

Unlike Jython/Python and Ruby (which are also very interesting), JavaScript is already deployed to >90% of the world through the web browser.

Hmmm, I wonder how far you can really go with JavaScript....

0 Comments:

Post a Comment

<< Home