Archive: December 2011

Proxies

V8 currently implements the same Proxy API as Firefox. The API for proxies has changed a bit since then so be extra careful when testing this. Proxies are a very low lever construct. The are very powerful and they allow an object to intercept any access to its properties as well as intercept things like ...

typeof null

In ES5 typeof null evaluates to 'object'. This quirk was one of the changes we wanted to fix in ES5 but at the time we agreed that we did not want any semantic changes. With Harmony there will be a way to opt in (TBD) so when you opt in we can now provide a ...

Block Scope

Did you know that ES5.1 does not support function declarations inside blocks? Browsers do allow it but they do not agree on the semantics. For ES Harmony we are specifying the semantics for functions inside blocks. Functions inside block use let scope, which means that they are limited to the current block scope. function f() ...

Harmony Collections

Simple maps and sets allow you to create a Map with an object as the key. Normally people use Object.create(null) as a map but that limits the keys to strings. The Set constructor is similar and it allows a set containing objects. Neither of these currently support a way of iteration since iteration is planned ...

JavaScript Harmony in Chrome

We recently added a way to turn on JavaScript Harmony features in Chrome. If you have a Canary or a recent Developer Channel build of Chrome you can turn on some Harmony features from chrome://flags. You need to manually enter that address in your browser. Look for an entry called “Enable Experimental JavaScript” The following ...