Traceur on JavaScript Jabber

Last week the interview with me on JavaScript Jabber went live. The interview is a about Traceur but we also ended up talking quite a bit about ES6.

JavaScript: Muddy Waters of Reflection

Just like a lot of other people I have a love-hate relationship with JavaScript. I love how expressive it is and I love that it runs everywhere but there are also some things where the languages falls very short. The gripe of the day is how JS makes reflection part of the everyday programming flow. ...

Iterating over Harmony Maps

A while ago Chrome got some JavaScript Harmony features (behind a flag). One of these features is the new Map “class”. The current implementation does not provide a way to iterate over the keys or values because that depends on Harmony iterators which are not yet implemented in V8. However, we can create our own ...

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 ...

EcmaScript Edition 5 is final

After a lot of back and forth in the TC and the failure of ES4 the TC was focused on ES3.1. The final spec for ES3.1 is now called EcmaScript, Fifth Edition. The most exciting thing in ES5 is that it finally standardize getters and setters. It also allows us to control the enumerability as ...

Using catch-alls to implement super in SpiderMonkey

Another thing that always been bothering me about OOP in JS is that calling super is such a pain. Some libraries do ugly hacks like checking the source (by calling toString on their constructor and method function objects) and then wrap the original function in another function that encapsulates a variable called super. Other libraries ...