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 2

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

Adding transformation passes to Traceur Compiler

Traceur Compiler is an open source ES.next to ES5 compiler. We released it a while back but today I finished writing a tutorial about how to add new transformation passes. As you can see it is pretty easy to add new passes and all you need to know is JavaScript to prototype the future of ...

Inheritance Antipattern

Michael Bolin wrote an excellent blog post about the inheritance antipattern that is gaining a lot of foothold among JavaScript developers these days. The post also links to an article giving a lot more depth on the topic. When I attended The Ajax Experience 2009, I saw a number of “misguided” things that people were ...