2009-08-01

The awesome Helma and the lacking JavaScript



I've written about the impressive Helma server-side JavaScript tool before.

Helma's been continually developed for decades by a group of nice people striving for excellence, mostly around Vienna, and in various Alpine valleys.

Last time I wrote about the pros of Helma. This time I'm going to focus on JavaScript, and why I think it sucks qua programming language.

JavaScript: The GOOD
  • Closures and proper lexical scope
  • Everything is an object (for most purposes)
  • Limited, but standardized library of data objects: numbers, strings, booleans, dictionaries, lists, null
  • Every variable and function can be changed at runtime
  • Varargs
  • Exceptions
  • No continuations
  • One of the most important and heavily used languages in the world
JavaScript: The DEBATABLE
  • No keyword parameters
  • No checking of number of arguments
JavaScript: The UGLY
  • Prototype system: Just read the spec. The mind boggles. What were they thinking? I don't think anyone can describe how the prototype stuff works in under one page.
  • this: I think the way JavaScript tries to keep it "simple" (haha!) and avoid a class system with the weird contraption that is constructor functions and this in functions is totally rejectable.
  • undefined: What's this for?
  • Unreadable spec
JavaScript: The BAD
  • No macros. You can't program seriously without them.
  • No class system. I think JavaScript should go the full way and offer a multiple-inheritance, runtime-redefinable class hierarchy. The topic of class linearization seems to be a solved problem, and one doesn't need OOP too much anyway. For all prototype weenies out there, such a dynamic class system would mean that you can still do all fancy tricks with extensible objects and mutable inheritance chains.
  • No module system. SML's module system is the best, and would probably work well for JavaScript. Its mechanics are beautiful and simple.
  • No big numbers. Serious damage for a dynamic language.
JavaScript: My ideas for making it better for SSJS
  • Add macros. Shouldn't be too hard, given that Dylan did it, and JavaScript has a quite regular syntax.
  • Add keyword and rest arguments, like Common Lisp.
  • Add a class system, and have method declarations outside of classes, like Common Lisp. Make exceptions objects.
  • Add SML's module system. Well, OK, that's probably overkill, but it would for once solve JavaScript's namespace issues. Or, even more radical, add Alice ML's packages.
  • Make exceptions restartable. Once you go restartable, you don't go back.
  • PlasticsLibraries
I, for one, will abstain from using the wicked language that is JavaScript. GWT is wonderful for the client side, and on the server Java is not too shabby, either.

Yes, Java is crap, but at least they brought in Guy Steele seconds before the point of no return. Python, Perl, and Ruby have a substantially higher crappiness factor than Java (and JavaScript). As Dave Moon would say, “they don't even suck”.

(BTW, my new Lisp will have most of the features noted above.)

1 comment:

Unknown said...

BTW & FYI: many (if not even most) issues JS suffers from and listed here are being addressed in [1]. :)

[1]: http://ringojs.org/

-- Robi