måndag, september 10, 2007

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.

7 kommentarer:

Debasish sa...

Hi Ola -

Introducing class based models in JS2 means moving away from the prototype based model. Do u think this is desirable ?

- Debasish

Ola Bini sa...

Debasish: Actually, the proposal for a class based model in JS2 is based on skinning, while still retaining the prototype based system beneath the covers, so you don't lose anything.

Prototyped object systems are quite cool, but on the other hand I'm not sure JS needs it... We'll see.

Swaroop C H sa...

Hi ola,

The latest spec is at http://wiki.ecmascript.org/doku.php?id=spec:spec

-- Swaroop

Steve sa...

Take a look at Adobe Flex. They have implemented JS2. I like the E4X support, this is really what XML processing should be like in Java!

jherber sa...

ola, have you looked at tamarin vm at all?


because it was built from the ground up for ecma script, i.e. a dynamic language, i often wonder if it was a suitable option for targeting than the jvm.

Christophe Grand sa...

Firefox 2.0 already has generators, iterators, array comprehensions, getters/setters and destructured assignements. See http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7.

seo toolsz896sf sa...

hydroponics can increase your yield by 40% see what nasa is doing on mars.
This hydroponic gardening site will show you the latest and greatest