JavaScript 2


After all discussions about the NBL and all surrounding issues, I realized I haven’t actually looked at what JavaScript 2/ECMAScript 4 will contain. I decided to do some research. What I found was mostly very old (2 years or so), but very enticing. If only half of it comes true, JS2 will be a power house. Of course, the C inspired JS syntax is still kind of repugnant, and it’s hard to see any kind of general purpose macro facility working on it. Pattern matching is the only reasonable way of getting macros in there, me thinks, and that just doesn’t pack the same power.

But still, there are seriously nice things there:

  • Classes (the classic kind), packages and namespaces
  • Destructuring
  • Generators and iterators
  • A real numeric tower
  • Optional static typing

The end result is that JS2 will look much more like Java, but pack greater power in many ways. I wouldn’t say that I agree about JS2 being the NBL, but we’re still talking some nice innovation here.