ES6 (ECMAScript 6)
The real question is: When can we use this new features? Now!? Browser vendors are working hard to implement this and the latest browsers are shipping big parts of the specification already. This website tracks the progress of the latest browsers. You can see a lot of red in this table – that’s why Traceur (compiles ES6 to ES5) comes to the rescue. –> So that your code will work in all modern browsers!
In this talk, Erik from the AngularJS Team explains, which additional features of ES6 will be used in Angular 2.0 and how Traceur works. There is also a Chrome extension named “ES6 transpiler based on Traceur” where you can try out your latest ES6 code 😉
AtScript (Angular Language Extension)
The goal of AtScript is to enhance the JS language (and also make programming Angular better) with these missing features:
- Type annotations
- Allows tools & IDEs to be awesome (better code autocompletion)
- No more JSDoc comments
- Type Assertions => catches errors (both in code and in type annotations)
- Field annotations
- Generates the constructor of a class, see example below
- Metadata Annotations
@Description()right before a function
- Will be used in Angular 2.0 for Dependency Injection or Component / Directive descriptions
- Type Introspection with Annotation Support
- Consistent API
The conclusion of Misko Hevery in his talk about AtScript was that it is not a new language, it is simply this equation:
AtScript = ES6 + Types + Annotations + Introspections
RIP everything you know.
Although Angular will run on ES5 browsers (the current world), changes being made to the core Angular architecture will break every Angular application. I recommend watching this talk for details, which include removal of controllers, current directive definition syntax, $scope, and more.
“We’re building AngularJS in ES6 now so you’ll have a framework that’s ready to take full advantage of ES6 as browsers add support,” says the team, though it will of course compile to ES5 code. You can easily write with TypeScript, ES6, ES5, CoffeeScript…whatever you like.
At present, you will get the best Angular experience by leveraging AtScript, due to its ability to automatically generate the metadata from language primitives, but it all translates to simple ES5 in the end.
So as we can see the whole web is evolving with ES6. As a front-end developer I think I will definitely not get bored any time soon in this bright-looking future 😉