Wednesday, November 21, 2007


Sometimes I have to use JavaScript for my daily programming, and while it takes some time to switch to it, it has certain beauty and allows some expressivity missing in "bigger" languages like Java or C#.

I tried to identify, what features make it shine, and what features might add even more to the mix.

So great and already present:
  1. Free extension of any object with properties ("every object is a dictionary").
  2. (Limited) introspection ("for in").
  3. Closures as first-class values ("closure is a value", and even "closure is an object").
  4. Prototypes for ad hoc extensibility, e.g., interception of closure invocation at prototype level.

Potentially great, but missing:

  1. Ergonomic way to qualify property names (a la XML or RDF).
  2. More and deeper interception - e.g., access to properties (get/put/foreach).
  3. More advanced control operators - e.g., co-routines and generators.
  4. Concurrency at language level.
  5. More like a constraint on other features - capability-based security.

I see certain synergy among proposed features, so adding them may not automatically turn the language into a kitchen sink.

I would try to approach features 3 to 5 via join calculus. Now, if I only had time.

No comments: