SlideShare a Scribd company logo
1 of 70
Download to read offline
ECMAScript 6
Dr. Axel Rauschmayer
rauschma.de
2013-03-30
CodeFest 2013, Novosibirsk
About me
Axel Rauschmayer:
Editor of JavaScript Weekly
Author of 2ality.com
Co-organizer of MunichJS
I have written about ECMAScript.next/ECMAScript 6 since early 2011.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 2 / 70
JavaScript: it has become big
Photographer: Via Tsuji
Used for much more than it was
originally created for.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 3 / 70
ECMAScript 6
ECMAScript 6:
Next version of JavaScript
(current engines: ECMAScript 5).
Be better at what JavaScript is used for now.
This talk:
Specific goals for ECMAScript 6?
How is ECMAScript 6 created?
Features?
Warning
All information in this talk is preliminary, features can and will change
before ECMAScript 6 is final.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 4 / 70
Background
Glossary
TC39 (Ecma Technical Committee 39): the committee evolving
JavaScript.
Members: companies (all major browser vendors etc.).
Meetings attended by employees and invited experts.
JavaScript: colloquially: the language; formally: one implementation
ECMAScript: the language standard
ECMAScript Harmony: improvements after ECMAScript 5 (several
versions)
ECMAScript.next: code name for upcoming version, subset of
Harmony
ECMAScript 6: the final name of ECMAScript.next (probably)
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 6 / 70
Goals for ECMAScript 6
One of several goals [1]: make JavaScript better
for complex applications
for libraries (possibly including the DOM)
as a target of code generators
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 7 / 70
Challenges of evolving a web language
Little control over ECMAScript versions:
1 Browsers: encounter code in many different versions.
Even within a single app (third party code!).
2 Apps: encounter engines supporting a variety of versions.
Constraints for ECMAScript 6:
#1 ⇒ Must not break existing code.
#2 ⇒ Can’t be used right away (not everywhere).
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 8 / 70
Challenges of evolving a web language
don’t break
existing
code
add new
features
fix pitfalls
preserve
nature of
JavaScript
Goals Requirements
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 9 / 70
How features are designed
Avoid “design by committee”:
Design by “champions” (groups of 1–2 experts)
Feedback from TC39 and the web community
TC39 has final word on whether to include
Stages [2]:
Strawman proposal
TC39 is interested ⇒ proposal
Field-testing via one or more implementations, refinements
TC39 accepts feature ⇒ included in ECMAScript draft
Included in final spec ⇒ Standard
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 10 / 70
Variables and scoping
Block-scoped variables
Function scope (var)
function order(x, y) {
console.log(tmp);
// undefined
if (x > y) {
var tmp = x;
x = y;
y = tmp;
}
return [x, y];
}
Block scope (let, const)
function order(x, y) {
console.log(tmp);
// ReferenceError:
// tmp is not defined
if (x > y) {
let tmp = x;
x = y;
y = tmp;
}
return [x, y];
}
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 12 / 70
Destructuring: objects
Extract data (more than one value!) via patterns:
let obj = { first: 'Jane', last: 'Doe' };
let { first: f , last: l } = obj;
console.log(f + ' ' + l); // Jane Doe
let { first, last } = obj;
// same as { first: first , last: last }
console.log(first + ' ' + last); // Jane Doe
Usage: variable declarations, assignments, parameter definitions.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 13 / 70
Destructuring: arrays
let [x, y] = [ 'a', 'b' ]; // x='a', y='b'
let [x, y] = [ 'a', 'b', 'c', 'd' ]; // x='a', y='b'
let [x, y, ...rest] = [ 'a', 'b', 'c', 'd' ];
// x='a', y='b', rest = [ 'c', 'd' ]
[x,y] = [y,x];
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 14 / 70
Destructuring: refutable by default
Refutable (default): exception if match isn’t exact.
{ a: x, b: y } = { a: 3 }; // fails
Irrefutable: always match.
{ a: x, ?b: y } = { a: 3 }; // x=3, y=undefined
Default value: use if no match or value is undefined
{ a: x, b: y=5 } = { a: 3 }; // x=3, y=5
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 15 / 70
Functions and parameters
Arrow functions: less to type
Compare:
let squares = [1, 2, 3].map(x => x * x);
let squares = [1, 2, 3].map(function (x) {return x * x});
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 17 / 70
Arrow functions: lexical this, no more that=this
function UiComponent {
var that = this;
var button = document.getElementById('#myButton');
button.addEventListener('click', function () {
console.log('CLICK');
that.handleClick();
});
}
UiComponent.prototype.handleClick = function () { ... };
function UiComponent {
let button = document.getElementById('#myButton');
button.addEventListener('click', () => {
console.log('CLICK');
this.handleClick();
});
}
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 18 / 70
Arrow functions: variants
Zero parameters:
() => expr
() => { stmt0; stmt1; ... }
One parameter:
arg => expr
arg => { stmt0; stmt1; ... }
More than one parameter:
(arg0, arg1, ...) => expr
(arg0, arg1, ...) => { stmt0; stmt1; ... }
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 19 / 70
Parameter handling 1: parameter default values
Give missing parameters a default value.
function func1(x, y=3) {
return [x,y];
}
Interaction:
> func1(1, 2)
[1, 2]
> func1(1)
[1, 3]
> func1()
[undefined, 3]
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 20 / 70
Parameter handling 2: rest parameters
Put trailing parameters in an array.
function func2(arg0, ...others) {
return others;
}
Interaction:
> func2(0, 1, 2, 3)
[1, 2, 3]
> func2(0)
[]
> func2()
[]
Eliminate the need for the special variable arguments.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 21 / 70
Parameter handling 3: named parameters
Idea: name parameters via an object literal.
More descriptive:
moveTo({ x: 50, y: 50, speed: 0.5 })
Easy to omit:
foo({ opt1: 'a', opt2: 'b', opt3: 'c' })
foo({ opt3: 'c' })
foo({ opt1: 'a', opt3: 'c' })
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 22 / 70
Parameter handling 3: named parameters
Use destructuring for named parameters opt1 and opt2:
function func3(arg0, { opt1, opt2 }) {
return return [opt1, opt2];
}
Interaction:
> func3(0, { opt1: 'a', opt2: 'b' })
['a', 'b']
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 23 / 70
Spread operator (...)
Turn an array into function/method arguments:
> Math.max(7, 4, 11)
11
> Math.max(...[7, 4, 11])
11
The inverse of a rest parameter
Mostly replaces Function.prototype.apply()
Also works in constructors
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 24 / 70
Modularity
Object literals
// ECMAScript 6
let obj = {
__proto__: someObject, // special property
myMethod(arg1, arg2) { // method definition
...
}
};
// ECMAScript 5
var obj = Object.create(someObject);
obj.myMethod = function (arg1, arg2) {
...
};
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 26 / 70
Object literals: property value shorthand
Shorthand: {x,y} is the same as { x: x, y: y }.
function computePoint() {
let x = computeX();
let y = computeY();
return { x, y }; // shorthand
}
let {x,y} = computePoint(); // shorthand
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 27 / 70
Symbols
Each symbol is a unique value. Use as
enum-style values
property keys:
let sym = Symbol();
console.log(typeof sym); // symbol
let obj = {
[sym](arg) { // computed property key
...
}
};
obj[sym](123);
Advantages of symbols as property keys:
No name clashes!
Configure various aspects of the language
⇒ import public symbols from a system module
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 28 / 70
Classes
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
toString() {
return '('+this.x+', '+this.y+')';
}
}
function Point(x, y) {
this.x = x;
this.y = y;
}
Point.prototype.toString = function () {
return '('+this.x+', '+this.y+')';
};
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 29 / 70
Classes: sub-type
class ColorPoint extends Point {
constructor(x, y, color) {
super(x, y); // same as super.constructor(x, y)
this.color = color;
}
toString() {
return this.color+' '+super();
}
}
function ColorPoint(x, y, color) {
Point.call(this, x, y);
this.color = color;
}
ColorPoint.prototype = Object.create(Point.prototype);
ColorPoint.prototype.constructor = ColorPoint;
ColorPoint.prototype.toString = function () {
return this.color+' '+Point.prototype.toString.call(this);
};
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 30 / 70
Static methods
class Point {
static zero() {
return new Point(0, 0);
}
constructor(x, y) {
this.x = x;
this.y = y;
}
}
let p = Point.zero();
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 31 / 70
Private properties
Hiding some properties from external access (object literals, classes):
Still under discussion.
But there will be some way of doing it.
Possibly: a special kind of symbol.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 32 / 70
Modules: overview
// lib/math.js
let notExported = 'abc';
export function square(x) {
return x * x;
}
export const MY_CONSTANT = 123;
// main.js
import {square} from 'lib/math';
console.log(square(3));
Alternatively:
import 'lib/math' as math;
console.log(math.square(3));
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 33 / 70
Modules: features
More features [3]:
Rename imports
Concatenation: put several modules in the same file
Module IDs are configurable (default: paths relative to importing file)
Programmatic (e.g. conditional) loading of modules via an API
Module loading is customizable:
Automatic linting
Automatically translate files (CoffeeScript, TypeScript)
Use legacy modules (AMD, Node.js)
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 34 / 70
Loops and iteration
Iterables and iterators
[iterate]()
...
Iterable:
traversable data structure
next()
Iterator:
pointer for traversing iterable
returns
Examples of iterables:
Arrays
Results produced by tool functions and methods
(keys(), values(), entries()).
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 36 / 70
Iterators
import {iterate} from '@iter'; // symbol
function iterArray(arr) {
let i = 0;
return { // both iterable and iterator
[iterate]() { // iterable
return this; // iterator
},
next() { // iterator
if (i < arr.length) {
return { value: arr[i++] };
} else {
return { done: true };
} } } }
for (let elem of iterArray(['a', 'b'])) {
console.log(elem);
}
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 37 / 70
for-of: a better loop
for-in loop:
Basically useless for arrays
Quirky for objects
Array.prototype.forEach(): doesn’t work with iterables.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 38 / 70
for-of loop: arrays
Looping over iterables.
let arr = [ 'hello', 'world' ];
for (let elem of arr) {
console.log(elem);
}
Output:
hello
world
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 39 / 70
for-of loop: objects
let obj = { first: 'Jane', last: 'Doe' };
Iterate over properties:
import {entries} from '@iter'; // returns an iterable
for (let [key, value] of entries(obj)) {
console.log(key + ' = ' + value);
}
Iterate over property names:
import {keys} from '@iter'; // returns an iterable
for (let name of keys(obj)) {
console.log(name);
}
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 40 / 70
Template strings
Template strings: string interpolation
Invocation:
templateHandler`Hello ${firstName} ${lastName}!`
Syntactic sugar for:
templateHandler(['Hello ', ' ', '!'], firstName, lastName)
Two kinds of tokens:
Literal sections (static): 'Hello'
Substitutions (dynamic): firstName
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 42 / 70
Template strings: raw strings
No escaping, multiple lines:
var str = raw`This is a text
with multiple lines.
Escapes are not interpreted,
n is not a newline.`;
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 43 / 70
Template strings: regular expressions
ECMAScript 5 (XRegExp library):
var str = '/2012/10/Page.html';
var parts = str.match(XRegExp(
'^ # match at start of string only n' +
'/ (?<year> [^/]+ ) # capture top dir as year n' +
'/ (?<month> [^/]+ ) # capture subdir as month n' +
'/ (?<title> [^/]+ ) # file name base n' +
'.html? # file name extension: .htm or .html n' +
'$ # end of string',
'x'
));
console.log(parts.year); // 2012
XRegExp features: named groups, ignored whitespace, comments.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 44 / 70
Template strings: regular expressions
ECMAScript 6:
let str = '/2012/10/Page.html';
let parts = str.match(XRegExp.rx`
^ # match at start of string only
/ (?<year> [^/]+ ) # capture top dir as year
/ (?<month> [^/]+ ) # capture subdir as month
/ (?<title> [^/]+ ) # file name base
.html? # file name extension: .htm or .html
$ # end of string
`);
Advantages:
Raw characters: no need to escape backslash and quote
Multi-line: no need to concatenate strings with newlines at the end
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 45 / 70
Template strings: other use cases
Query languages
Text localization
Secure templates
etc.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 46 / 70
Standard library
Maps
Data structure mapping from arbitrary values to arbitrary values
(objects: keys must be strings).
let map = new Map();
let obj = {};
map.set(obj, 123);
console.log(map.get(obj)); // 123
console.log(map.has(obj)); // true
map.delete(obj);
console.log(map.has(obj)); // false
Also: iteration (over keys, values, entries) and more.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 48 / 70
Weak maps
Idea – a map with weakly held keys:
Map objects to data.
Don’t prevent objects from being garbage-collected.
Use cases: privately associating data with objects, private caches, . . .
Constraints:
Can’t enumerate contents
Keys are objects, values are arbitrary values
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 49 / 70
Sets
A collection of values without duplicates.
let set1 = new Set();
set1.add('hello');
console.log(set1.has('hello')); // true
console.log(set1.has('world')); // false
let set2 = new Set([3,2,1,3,2,3]);
console.log(set2.values()); // 1,2,3
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 50 / 70
Object.assign
Merge one object into another one.
class Point {
constructor(x, y) {
Object.assign(this, { x, y });
}
}
Similar to Underscore.js _.extend().
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 51 / 70
Various other additions to the standard library
> 'abc'.repeat(3)
'abcabcabc'
> 'abc'.startsWith('ab')
true
> 'abc'.endsWith('bc')
true
And more!
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 52 / 70
Generators
function* generatorFunction() {
...
yield x;
...
}
generatorObject
returns
next()
yield
next()
yield
Generators: suspend and resume
a function
Shallow coroutines [4]: only
function body is suspended.
Uses: iterators, simpler
asynchronous programming.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 54 / 70
Generators: example
Suspend via yield (“resumable return”):
function* generatorFunction() {
yield 0;
yield 1;
yield 2;
}
Start and resume via next():
let genObj = generatorFunction();
console.log(genObj.next()); // 0
console.log(genObj.next()); // 1
console.log(genObj.next()); // 2
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 55 / 70
Generators: implementing an iterator
An iterator for nested arrays:
function* iterTree(tree) {
if (Array.isArray(tree)) {
// inner node
for(let i=0; i < tree.length; i++) {
yield* iterTree(tree[i]); // recursion
}
} else {
// leaf
yield tree;
}
}
Difficult to write without recursion.
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 56 / 70
Generators: asynchronous programming
Using the task.js library:
spawn(function* () {
try {
var [foo, bar] = yield join(
read("foo.json") , read("bar.json")
).timeout(1000);
render(foo);
render(bar);
} catch (e) {
console.log("read failed: " + e);
}
});
Wait for asynchronous calls via yield (internally based on promises).
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 57 / 70
Proxies
Proxies
Observe operations applied to object proxy, via handler h:
let target = {};
let proxy = Proxy(target, h);
Each of the following operations triggers a method invocation on h:
proxy['foo'] → h.get(target, 'foo', p)
proxy['foo'] = 123 → h.set(target, 'foo', 123, p)
'foo' in proxy → h.has(target, 'foo')
for (key in proxy) {...} → h.enumerate(target)
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 59 / 70
Proxies in the prototype chain
let child = Object.create(proxy);
Operations on child can still trigger handler invocations
(if the search for properties reaches proxy):
child['foo'] → h.get(target, 'foo', ch)
child['foo'] = 123 → h.set(target, 'foo', 123, ch)
'foo' in child → h.has(target, 'foo')
for (key in child) {...} → h.enumerate(target)
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 60 / 70
Proxy: example
let handler = {
get(target, name, receiver) {
return (...args) => {
console.log('Missing method '+name
+ ', arguments: '+args);
}
}
};
let proxy = Proxy({}, handler);
Using the handler:
> let obj = Object.create(proxy);
> obj.foo(1, 2)
Missing method foo, arguments: 1, 2
undefined
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 61 / 70
Use cases for proxies
Typical meta-programming tasks:
Sending all method invocations to a remote object
Implementing data access objects for a database
Data binding
Logging
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 62 / 70
Conclusion
Time table
ECMAScript specification:
November 2013: final review of draft
July 2014: editorially complete
December 2014: Ecma approval
Features are already appearing in JavaScript engines [5]!
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 64 / 70
Thank you!
References
1 ECMAScript Harmony wiki
2 “The Harmony Process” by David Herman
3 “ES6 Modules” by Yehuda Katz
4 “Why coroutines won’t work on the web” by David Herman
5 “ECMAScript 6 compatibility table” by kangax [features already in
JavaScript engines]
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 66 / 70
Resources
ECMAScript 6 specification drafts by Allen Wirfs-Brock
ECMAScript mailing list: es-discuss
TC39 meeting notes by Rick Waldron
“A guide to 2ality’s posts on ECMAScript 6” by Axel Rauschmayer
Continuum, an ECMAScript 6 virtual machine written in
ECMAScript 3.
(Links are embedded in this slide.)
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 67 / 70
Bonus slides
Function-scoping: pitfall
function foo() {
var x = 3;
if (x >= 0) {
var tmp;
console.log(tmp); // undefined
tmp = 'abc';
}
if (x > 0) {
var tmp;
console.log(tmp); // abc
}
}
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 69 / 70
Comprehensions
Array comprehensions produce an array:
let numbers = [1,2,3];
let squares = [for (x of numbers) x*x];
Generator comprehensions produce a generator object (an iterator):
let squares = (for (x of numbers) x*x);
Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 70 / 70

More Related Content

What's hot

Introduction to NumPy for Machine Learning Programmers
Introduction to NumPy for Machine Learning ProgrammersIntroduction to NumPy for Machine Learning Programmers
Introduction to NumPy for Machine Learning ProgrammersKimikazu Kato
 
Clojure for Data Science
Clojure for Data ScienceClojure for Data Science
Clojure for Data ScienceMike Anderson
 
Machine Learning Live
Machine Learning LiveMachine Learning Live
Machine Learning LiveMike Anderson
 
Building a website in Haskell coming from Node.js
Building a website in Haskell coming from Node.jsBuilding a website in Haskell coming from Node.js
Building a website in Haskell coming from Node.jsNicolas Hery
 
Procedural Content Generation with Clojure
Procedural Content Generation with ClojureProcedural Content Generation with Clojure
Procedural Content Generation with ClojureMike Anderson
 
10. Getting Spatial
10. Getting Spatial10. Getting Spatial
10. Getting SpatialFAO
 
Clojure for Data Science
Clojure for Data ScienceClojure for Data Science
Clojure for Data Sciencehenrygarner
 
Nyc open-data-2015-andvanced-sklearn-expanded
Nyc open-data-2015-andvanced-sklearn-expandedNyc open-data-2015-andvanced-sklearn-expanded
Nyc open-data-2015-andvanced-sklearn-expandedVivian S. Zhang
 
Deep learning study 3
Deep learning study 3Deep learning study 3
Deep learning study 3San Kim
 
RMI Java Programming Lab Manual 2019
RMI Java Programming Lab Manual 2019RMI Java Programming Lab Manual 2019
RMI Java Programming Lab Manual 2019Gebreigziabher Ab
 
Haskell for data science
Haskell for data scienceHaskell for data science
Haskell for data scienceJohn Cant
 
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...Philip Schwarz
 
Gradient boosting in practice: a deep dive into xgboost
Gradient boosting in practice: a deep dive into xgboostGradient boosting in practice: a deep dive into xgboost
Gradient boosting in practice: a deep dive into xgboostJaroslaw Szymczak
 
String in .net
String in .netString in .net
String in .netLarry Nung
 
Rendering Art on the Web - A Performance compendium
Rendering Art on the Web - A Performance compendiumRendering Art on the Web - A Performance compendium
Rendering Art on the Web - A Performance compendiumRaimon Ràfols
 
Spotify 2016 - Beyond Lambdas - the Aftermath
Spotify 2016 - Beyond Lambdas - the AftermathSpotify 2016 - Beyond Lambdas - the Aftermath
Spotify 2016 - Beyond Lambdas - the AftermathDaniel Sawano
 

What's hot (20)

Introduction to NumPy for Machine Learning Programmers
Introduction to NumPy for Machine Learning ProgrammersIntroduction to NumPy for Machine Learning Programmers
Introduction to NumPy for Machine Learning Programmers
 
Clojure for Data Science
Clojure for Data ScienceClojure for Data Science
Clojure for Data Science
 
Java file
Java fileJava file
Java file
 
Machine Learning Live
Machine Learning LiveMachine Learning Live
Machine Learning Live
 
Building a website in Haskell coming from Node.js
Building a website in Haskell coming from Node.jsBuilding a website in Haskell coming from Node.js
Building a website in Haskell coming from Node.js
 
Second chapter-java
Second chapter-javaSecond chapter-java
Second chapter-java
 
Procedural Content Generation with Clojure
Procedural Content Generation with ClojureProcedural Content Generation with Clojure
Procedural Content Generation with Clojure
 
10. Getting Spatial
10. Getting Spatial10. Getting Spatial
10. Getting Spatial
 
Clojure for Data Science
Clojure for Data ScienceClojure for Data Science
Clojure for Data Science
 
Nyc open-data-2015-andvanced-sklearn-expanded
Nyc open-data-2015-andvanced-sklearn-expandedNyc open-data-2015-andvanced-sklearn-expanded
Nyc open-data-2015-andvanced-sklearn-expanded
 
Clojure class
Clojure classClojure class
Clojure class
 
Deep learning study 3
Deep learning study 3Deep learning study 3
Deep learning study 3
 
Data transformation-cheatsheet
Data transformation-cheatsheetData transformation-cheatsheet
Data transformation-cheatsheet
 
RMI Java Programming Lab Manual 2019
RMI Java Programming Lab Manual 2019RMI Java Programming Lab Manual 2019
RMI Java Programming Lab Manual 2019
 
Haskell for data science
Haskell for data scienceHaskell for data science
Haskell for data science
 
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
 
Gradient boosting in practice: a deep dive into xgboost
Gradient boosting in practice: a deep dive into xgboostGradient boosting in practice: a deep dive into xgboost
Gradient boosting in practice: a deep dive into xgboost
 
String in .net
String in .netString in .net
String in .net
 
Rendering Art on the Web - A Performance compendium
Rendering Art on the Web - A Performance compendiumRendering Art on the Web - A Performance compendium
Rendering Art on the Web - A Performance compendium
 
Spotify 2016 - Beyond Lambdas - the Aftermath
Spotify 2016 - Beyond Lambdas - the AftermathSpotify 2016 - Beyond Lambdas - the Aftermath
Spotify 2016 - Beyond Lambdas - the Aftermath
 

Viewers also liked

CodeFest 2011. Токарев О — Конструирование кода: «Думай верно!» (или 5 Правил...
CodeFest 2011. Токарев О — Конструирование кода: «Думай верно!» (или 5 Правил...CodeFest 2011. Токарев О — Конструирование кода: «Думай верно!» (или 5 Правил...
CodeFest 2011. Токарев О — Конструирование кода: «Думай верно!» (или 5 Правил...CodeFest
 
CodeFest 2014. Орешкина Е. — Информационная архитектура в быту, работе и стар...
CodeFest 2014. Орешкина Е. — Информационная архитектура в быту, работе и стар...CodeFest 2014. Орешкина Е. — Информационная архитектура в быту, работе и стар...
CodeFest 2014. Орешкина Е. — Информационная архитектура в быту, работе и стар...CodeFest
 
CodeFest 2012. Шкарин П. — Отказоустойчивость или высокие нагрузки
CodeFest 2012. Шкарин П. — Отказоустойчивость или высокие нагрузкиCodeFest 2012. Шкарин П. — Отказоустойчивость или высокие нагрузки
CodeFest 2012. Шкарин П. — Отказоустойчивость или высокие нагрузкиCodeFest
 
CodeFest 2012. Ильин А. — Метрики покрытия. Прагматичный подход
CodeFest 2012. Ильин А. — Метрики покрытия. Прагматичный подходCodeFest 2012. Ильин А. — Метрики покрытия. Прагматичный подход
CodeFest 2012. Ильин А. — Метрики покрытия. Прагматичный подходCodeFest
 
CodeFest 2012. Иванов В. — G1: новый сборщик мусора в HotSpot JVM
CodeFest 2012. Иванов В. — G1: новый сборщик мусора в HotSpot JVMCodeFest 2012. Иванов В. — G1: новый сборщик мусора в HotSpot JVM
CodeFest 2012. Иванов В. — G1: новый сборщик мусора в HotSpot JVMCodeFest
 
CodeFest 2012. Рыжиков С. — Архитектура и запуск облачного сервиса в Amazon A...
CodeFest 2012. Рыжиков С. — Архитектура и запуск облачного сервиса в Amazon A...CodeFest 2012. Рыжиков С. — Архитектура и запуск облачного сервиса в Amazon A...
CodeFest 2012. Рыжиков С. — Архитектура и запуск облачного сервиса в Amazon A...CodeFest
 
CodeFest 2013. Русанов П. — Есть ли жизнь в оффлайне? Кеш, транзакционный лог...
CodeFest 2013. Русанов П. — Есть ли жизнь в оффлайне? Кеш, транзакционный лог...CodeFest 2013. Русанов П. — Есть ли жизнь в оффлайне? Кеш, транзакционный лог...
CodeFest 2013. Русанов П. — Есть ли жизнь в оффлайне? Кеш, транзакционный лог...CodeFest
 
CodeFest 2013. Днепровский П. — Морковка: спереди или сзади? Игровые механики...
CodeFest 2013. Днепровский П. — Морковка: спереди или сзади? Игровые механики...CodeFest 2013. Днепровский П. — Морковка: спереди или сзади? Игровые механики...
CodeFest 2013. Днепровский П. — Морковка: спереди или сзади? Игровые механики...CodeFest
 
CodeFest 2013. Гилев Е. — Создание пользовательского интерфейса без программи...
CodeFest 2013. Гилев Е. — Создание пользовательского интерфейса без программи...CodeFest 2013. Гилев Е. — Создание пользовательского интерфейса без программи...
CodeFest 2013. Гилев Е. — Создание пользовательского интерфейса без программи...CodeFest
 
CodeFest 2013. Бурмако Е. — Макросы в Скале
CodeFest 2013. Бурмако Е. — Макросы в СкалеCodeFest 2013. Бурмако Е. — Макросы в Скале
CodeFest 2013. Бурмако Е. — Макросы в СкалеCodeFest
 
Keynote: Challenges, Pains and Points of Software Development Today
Keynote: Challenges, Pains and Points of Software Development TodayKeynote: Challenges, Pains and Points of Software Development Today
Keynote: Challenges, Pains and Points of Software Development TodayCodeFest
 
CodeFest 2013. Агафонкин В. — Высокопроизводительные визуализации данных в бр...
CodeFest 2013. Агафонкин В. — Высокопроизводительные визуализации данных в бр...CodeFest 2013. Агафонкин В. — Высокопроизводительные визуализации данных в бр...
CodeFest 2013. Агафонкин В. — Высокопроизводительные визуализации данных в бр...CodeFest
 
CodeFest 2014. Сибирев А. — Управление инфраструктурой под Cocaine
CodeFest 2014. Сибирев А. — Управление инфраструктурой под CocaineCodeFest 2014. Сибирев А. — Управление инфраструктурой под Cocaine
CodeFest 2014. Сибирев А. — Управление инфраструктурой под CocaineCodeFest
 
CodeFest 2010. Уразов А. — Quality-Oriented Programming (Программирование, ор...
CodeFest 2010. Уразов А. — Quality-Oriented Programming (Программирование, ор...CodeFest 2010. Уразов А. — Quality-Oriented Programming (Программирование, ор...
CodeFest 2010. Уразов А. — Quality-Oriented Programming (Программирование, ор...CodeFest
 
CodeFest 2011. Сидоров А. — Почему некоторые программисты любят изобретать «в...
CodeFest 2011. Сидоров А. — Почему некоторые программисты любят изобретать «в...CodeFest 2011. Сидоров А. — Почему некоторые программисты любят изобретать «в...
CodeFest 2011. Сидоров А. — Почему некоторые программисты любят изобретать «в...CodeFest
 
CodeFest 2012. Каплинский К. — Разработка Open Source продуктов как прибыльны...
CodeFest 2012. Каплинский К. — Разработка Open Source продуктов как прибыльны...CodeFest 2012. Каплинский К. — Разработка Open Source продуктов как прибыльны...
CodeFest 2012. Каплинский К. — Разработка Open Source продуктов как прибыльны...CodeFest
 
CodeFest 2013. Прокопов Н. — Зачем вам нужна Clojure?
CodeFest 2013. Прокопов Н. — Зачем вам нужна Clojure?CodeFest 2013. Прокопов Н. — Зачем вам нужна Clojure?
CodeFest 2013. Прокопов Н. — Зачем вам нужна Clojure?CodeFest
 
Codefest 2011. Вольфтруб А. — О чем стоит подумать, приступая к разработке вы...
Codefest 2011. Вольфтруб А. — О чем стоит подумать, приступая к разработке вы...Codefest 2011. Вольфтруб А. — О чем стоит подумать, приступая к разработке вы...
Codefest 2011. Вольфтруб А. — О чем стоит подумать, приступая к разработке вы...CodeFest
 
CodeFest 2014. Шипилёв А. — Java Benchmarking: как два таймстампа записать!
CodeFest 2014. Шипилёв А. — Java Benchmarking: как два таймстампа записать!CodeFest 2014. Шипилёв А. — Java Benchmarking: как два таймстампа записать!
CodeFest 2014. Шипилёв А. — Java Benchmarking: как два таймстампа записать!CodeFest
 
CodeFest 2013. Конев М. — Push-уведомления
CodeFest 2013. Конев М. — Push-уведомленияCodeFest 2013. Конев М. — Push-уведомления
CodeFest 2013. Конев М. — Push-уведомленияCodeFest
 

Viewers also liked (20)

CodeFest 2011. Токарев О — Конструирование кода: «Думай верно!» (или 5 Правил...
CodeFest 2011. Токарев О — Конструирование кода: «Думай верно!» (или 5 Правил...CodeFest 2011. Токарев О — Конструирование кода: «Думай верно!» (или 5 Правил...
CodeFest 2011. Токарев О — Конструирование кода: «Думай верно!» (или 5 Правил...
 
CodeFest 2014. Орешкина Е. — Информационная архитектура в быту, работе и стар...
CodeFest 2014. Орешкина Е. — Информационная архитектура в быту, работе и стар...CodeFest 2014. Орешкина Е. — Информационная архитектура в быту, работе и стар...
CodeFest 2014. Орешкина Е. — Информационная архитектура в быту, работе и стар...
 
CodeFest 2012. Шкарин П. — Отказоустойчивость или высокие нагрузки
CodeFest 2012. Шкарин П. — Отказоустойчивость или высокие нагрузкиCodeFest 2012. Шкарин П. — Отказоустойчивость или высокие нагрузки
CodeFest 2012. Шкарин П. — Отказоустойчивость или высокие нагрузки
 
CodeFest 2012. Ильин А. — Метрики покрытия. Прагматичный подход
CodeFest 2012. Ильин А. — Метрики покрытия. Прагматичный подходCodeFest 2012. Ильин А. — Метрики покрытия. Прагматичный подход
CodeFest 2012. Ильин А. — Метрики покрытия. Прагматичный подход
 
CodeFest 2012. Иванов В. — G1: новый сборщик мусора в HotSpot JVM
CodeFest 2012. Иванов В. — G1: новый сборщик мусора в HotSpot JVMCodeFest 2012. Иванов В. — G1: новый сборщик мусора в HotSpot JVM
CodeFest 2012. Иванов В. — G1: новый сборщик мусора в HotSpot JVM
 
CodeFest 2012. Рыжиков С. — Архитектура и запуск облачного сервиса в Amazon A...
CodeFest 2012. Рыжиков С. — Архитектура и запуск облачного сервиса в Amazon A...CodeFest 2012. Рыжиков С. — Архитектура и запуск облачного сервиса в Amazon A...
CodeFest 2012. Рыжиков С. — Архитектура и запуск облачного сервиса в Amazon A...
 
CodeFest 2013. Русанов П. — Есть ли жизнь в оффлайне? Кеш, транзакционный лог...
CodeFest 2013. Русанов П. — Есть ли жизнь в оффлайне? Кеш, транзакционный лог...CodeFest 2013. Русанов П. — Есть ли жизнь в оффлайне? Кеш, транзакционный лог...
CodeFest 2013. Русанов П. — Есть ли жизнь в оффлайне? Кеш, транзакционный лог...
 
CodeFest 2013. Днепровский П. — Морковка: спереди или сзади? Игровые механики...
CodeFest 2013. Днепровский П. — Морковка: спереди или сзади? Игровые механики...CodeFest 2013. Днепровский П. — Морковка: спереди или сзади? Игровые механики...
CodeFest 2013. Днепровский П. — Морковка: спереди или сзади? Игровые механики...
 
CodeFest 2013. Гилев Е. — Создание пользовательского интерфейса без программи...
CodeFest 2013. Гилев Е. — Создание пользовательского интерфейса без программи...CodeFest 2013. Гилев Е. — Создание пользовательского интерфейса без программи...
CodeFest 2013. Гилев Е. — Создание пользовательского интерфейса без программи...
 
CodeFest 2013. Бурмако Е. — Макросы в Скале
CodeFest 2013. Бурмако Е. — Макросы в СкалеCodeFest 2013. Бурмако Е. — Макросы в Скале
CodeFest 2013. Бурмако Е. — Макросы в Скале
 
Keynote: Challenges, Pains and Points of Software Development Today
Keynote: Challenges, Pains and Points of Software Development TodayKeynote: Challenges, Pains and Points of Software Development Today
Keynote: Challenges, Pains and Points of Software Development Today
 
CodeFest 2013. Агафонкин В. — Высокопроизводительные визуализации данных в бр...
CodeFest 2013. Агафонкин В. — Высокопроизводительные визуализации данных в бр...CodeFest 2013. Агафонкин В. — Высокопроизводительные визуализации данных в бр...
CodeFest 2013. Агафонкин В. — Высокопроизводительные визуализации данных в бр...
 
CodeFest 2014. Сибирев А. — Управление инфраструктурой под Cocaine
CodeFest 2014. Сибирев А. — Управление инфраструктурой под CocaineCodeFest 2014. Сибирев А. — Управление инфраструктурой под Cocaine
CodeFest 2014. Сибирев А. — Управление инфраструктурой под Cocaine
 
CodeFest 2010. Уразов А. — Quality-Oriented Programming (Программирование, ор...
CodeFest 2010. Уразов А. — Quality-Oriented Programming (Программирование, ор...CodeFest 2010. Уразов А. — Quality-Oriented Programming (Программирование, ор...
CodeFest 2010. Уразов А. — Quality-Oriented Programming (Программирование, ор...
 
CodeFest 2011. Сидоров А. — Почему некоторые программисты любят изобретать «в...
CodeFest 2011. Сидоров А. — Почему некоторые программисты любят изобретать «в...CodeFest 2011. Сидоров А. — Почему некоторые программисты любят изобретать «в...
CodeFest 2011. Сидоров А. — Почему некоторые программисты любят изобретать «в...
 
CodeFest 2012. Каплинский К. — Разработка Open Source продуктов как прибыльны...
CodeFest 2012. Каплинский К. — Разработка Open Source продуктов как прибыльны...CodeFest 2012. Каплинский К. — Разработка Open Source продуктов как прибыльны...
CodeFest 2012. Каплинский К. — Разработка Open Source продуктов как прибыльны...
 
CodeFest 2013. Прокопов Н. — Зачем вам нужна Clojure?
CodeFest 2013. Прокопов Н. — Зачем вам нужна Clojure?CodeFest 2013. Прокопов Н. — Зачем вам нужна Clojure?
CodeFest 2013. Прокопов Н. — Зачем вам нужна Clojure?
 
Codefest 2011. Вольфтруб А. — О чем стоит подумать, приступая к разработке вы...
Codefest 2011. Вольфтруб А. — О чем стоит подумать, приступая к разработке вы...Codefest 2011. Вольфтруб А. — О чем стоит подумать, приступая к разработке вы...
Codefest 2011. Вольфтруб А. — О чем стоит подумать, приступая к разработке вы...
 
CodeFest 2014. Шипилёв А. — Java Benchmarking: как два таймстампа записать!
CodeFest 2014. Шипилёв А. — Java Benchmarking: как два таймстампа записать!CodeFest 2014. Шипилёв А. — Java Benchmarking: как два таймстампа записать!
CodeFest 2014. Шипилёв А. — Java Benchmarking: как два таймстампа записать!
 
CodeFest 2013. Конев М. — Push-уведомления
CodeFest 2013. Конев М. — Push-уведомленияCodeFest 2013. Конев М. — Push-уведомления
CodeFest 2013. Конев М. — Push-уведомления
 

Similar to CodeFest 2013. Rauschmayer A. — An overview of ECMAScript 6, the next version of JavaScript

COS30008 Semester 1, 2016 Dr. Markus Lumpe 1 Swinbu.docx
COS30008 Semester 1, 2016 Dr. Markus Lumpe  1 Swinbu.docxCOS30008 Semester 1, 2016 Dr. Markus Lumpe  1 Swinbu.docx
COS30008 Semester 1, 2016 Dr. Markus Lumpe 1 Swinbu.docxvanesaburnand
 
Chainer ui v0.3 and imagereport
Chainer ui v0.3 and imagereportChainer ui v0.3 and imagereport
Chainer ui v0.3 and imagereportPreferred Networks
 
Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...Yao Yao
 
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)PROIDEA
 
Getting started with ES6
Getting started with ES6Getting started with ES6
Getting started with ES6Nitay Neeman
 
Language Language Models (in 2023) - OpenAI
Language Language Models (in 2023) - OpenAILanguage Language Models (in 2023) - OpenAI
Language Language Models (in 2023) - OpenAISamuelButler15
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptCaridy Patino
 
R programming lab 1 - jupyter notebook
R programming lab   1 - jupyter notebookR programming lab   1 - jupyter notebook
R programming lab 1 - jupyter notebookAshwini Mathur
 
Stata Programming Cheat Sheet
Stata Programming Cheat SheetStata Programming Cheat Sheet
Stata Programming Cheat SheetLaura Hughes
 
Julia: The language for future
Julia: The language for futureJulia: The language for future
Julia: The language for future岳華 杜
 
Refactor case study LAN example
Refactor case study LAN exampleRefactor case study LAN example
Refactor case study LAN exampleTom Mens
 
Time Series Analysis and Mining with R
Time Series Analysis and Mining with RTime Series Analysis and Mining with R
Time Series Analysis and Mining with RYanchang Zhao
 

Similar to CodeFest 2013. Rauschmayer A. — An overview of ECMAScript 6, the next version of JavaScript (20)

Lecture 2 f17
Lecture 2 f17Lecture 2 f17
Lecture 2 f17
 
python.ppt
python.pptpython.ppt
python.ppt
 
COS30008 Semester 1, 2016 Dr. Markus Lumpe 1 Swinbu.docx
COS30008 Semester 1, 2016 Dr. Markus Lumpe  1 Swinbu.docxCOS30008 Semester 1, 2016 Dr. Markus Lumpe  1 Swinbu.docx
COS30008 Semester 1, 2016 Dr. Markus Lumpe 1 Swinbu.docx
 
Chainer ui v0.3 and imagereport
Chainer ui v0.3 and imagereportChainer ui v0.3 and imagereport
Chainer ui v0.3 and imagereport
 
Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...
 
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)
 
Methods
MethodsMethods
Methods
 
Learn Matlab
Learn MatlabLearn Matlab
Learn Matlab
 
Getting started with ES6
Getting started with ES6Getting started with ES6
Getting started with ES6
 
Chap08
Chap08Chap08
Chap08
 
Language Language Models (in 2023) - OpenAI
Language Language Models (in 2023) - OpenAILanguage Language Models (in 2023) - OpenAI
Language Language Models (in 2023) - OpenAI
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScript
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
 
R programming lab 1 - jupyter notebook
R programming lab   1 - jupyter notebookR programming lab   1 - jupyter notebook
R programming lab 1 - jupyter notebook
 
Stata Programming Cheat Sheet
Stata Programming Cheat SheetStata Programming Cheat Sheet
Stata Programming Cheat Sheet
 
CppTutorial.ppt
CppTutorial.pptCppTutorial.ppt
CppTutorial.ppt
 
Julia: The language for future
Julia: The language for futureJulia: The language for future
Julia: The language for future
 
python.ppt
python.pptpython.ppt
python.ppt
 
Refactor case study LAN example
Refactor case study LAN exampleRefactor case study LAN example
Refactor case study LAN example
 
Time Series Analysis and Mining with R
Time Series Analysis and Mining with RTime Series Analysis and Mining with R
Time Series Analysis and Mining with R
 

More from CodeFest

Alexander Graebe
Alexander GraebeAlexander Graebe
Alexander GraebeCodeFest
 
Никита Прокопов
Никита ПрокоповНикита Прокопов
Никита ПрокоповCodeFest
 
Денис Баталов
Денис БаталовДенис Баталов
Денис БаталовCodeFest
 
Елена Гальцина
Елена ГальцинаЕлена Гальцина
Елена ГальцинаCodeFest
 
Александр Калашников
Александр КалашниковАлександр Калашников
Александр КалашниковCodeFest
 
Ирина Иванова
Ирина ИвановаИрина Иванова
Ирина ИвановаCodeFest
 
Marko Berković
Marko BerkovićMarko Berković
Marko BerkovićCodeFest
 
Денис Кортунов
Денис КортуновДенис Кортунов
Денис КортуновCodeFest
 
Александр Зимин
Александр ЗиминАлександр Зимин
Александр ЗиминCodeFest
 
Сергей Крапивенский
Сергей КрапивенскийСергей Крапивенский
Сергей КрапивенскийCodeFest
 
Сергей Игнатов
Сергей ИгнатовСергей Игнатов
Сергей ИгнатовCodeFest
 
Николай Крапивный
Николай КрапивныйНиколай Крапивный
Николай КрапивныйCodeFest
 
Alexander Graebe
Alexander GraebeAlexander Graebe
Alexander GraebeCodeFest
 
Вадим Смирнов
Вадим СмирновВадим Смирнов
Вадим СмирновCodeFest
 
Константин Осипов
Константин ОсиповКонстантин Осипов
Константин ОсиповCodeFest
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele RialdiCodeFest
 
Максим Пугачев
Максим ПугачевМаксим Пугачев
Максим ПугачевCodeFest
 
Rene Groeschke
Rene GroeschkeRene Groeschke
Rene GroeschkeCodeFest
 
Иван Бондаренко
Иван БондаренкоИван Бондаренко
Иван БондаренкоCodeFest
 
Mete Atamel
Mete AtamelMete Atamel
Mete AtamelCodeFest
 

More from CodeFest (20)

Alexander Graebe
Alexander GraebeAlexander Graebe
Alexander Graebe
 
Никита Прокопов
Никита ПрокоповНикита Прокопов
Никита Прокопов
 
Денис Баталов
Денис БаталовДенис Баталов
Денис Баталов
 
Елена Гальцина
Елена ГальцинаЕлена Гальцина
Елена Гальцина
 
Александр Калашников
Александр КалашниковАлександр Калашников
Александр Калашников
 
Ирина Иванова
Ирина ИвановаИрина Иванова
Ирина Иванова
 
Marko Berković
Marko BerkovićMarko Berković
Marko Berković
 
Денис Кортунов
Денис КортуновДенис Кортунов
Денис Кортунов
 
Александр Зимин
Александр ЗиминАлександр Зимин
Александр Зимин
 
Сергей Крапивенский
Сергей КрапивенскийСергей Крапивенский
Сергей Крапивенский
 
Сергей Игнатов
Сергей ИгнатовСергей Игнатов
Сергей Игнатов
 
Николай Крапивный
Николай КрапивныйНиколай Крапивный
Николай Крапивный
 
Alexander Graebe
Alexander GraebeAlexander Graebe
Alexander Graebe
 
Вадим Смирнов
Вадим СмирновВадим Смирнов
Вадим Смирнов
 
Константин Осипов
Константин ОсиповКонстантин Осипов
Константин Осипов
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele Rialdi
 
Максим Пугачев
Максим ПугачевМаксим Пугачев
Максим Пугачев
 
Rene Groeschke
Rene GroeschkeRene Groeschke
Rene Groeschke
 
Иван Бондаренко
Иван БондаренкоИван Бондаренко
Иван Бондаренко
 
Mete Atamel
Mete AtamelMete Atamel
Mete Atamel
 

Recently uploaded

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 

Recently uploaded (20)

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 

CodeFest 2013. Rauschmayer A. — An overview of ECMAScript 6, the next version of JavaScript

  • 1. ECMAScript 6 Dr. Axel Rauschmayer rauschma.de 2013-03-30 CodeFest 2013, Novosibirsk
  • 2. About me Axel Rauschmayer: Editor of JavaScript Weekly Author of 2ality.com Co-organizer of MunichJS I have written about ECMAScript.next/ECMAScript 6 since early 2011. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 2 / 70
  • 3. JavaScript: it has become big Photographer: Via Tsuji Used for much more than it was originally created for. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 3 / 70
  • 4. ECMAScript 6 ECMAScript 6: Next version of JavaScript (current engines: ECMAScript 5). Be better at what JavaScript is used for now. This talk: Specific goals for ECMAScript 6? How is ECMAScript 6 created? Features? Warning All information in this talk is preliminary, features can and will change before ECMAScript 6 is final. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 4 / 70
  • 6. Glossary TC39 (Ecma Technical Committee 39): the committee evolving JavaScript. Members: companies (all major browser vendors etc.). Meetings attended by employees and invited experts. JavaScript: colloquially: the language; formally: one implementation ECMAScript: the language standard ECMAScript Harmony: improvements after ECMAScript 5 (several versions) ECMAScript.next: code name for upcoming version, subset of Harmony ECMAScript 6: the final name of ECMAScript.next (probably) Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 6 / 70
  • 7. Goals for ECMAScript 6 One of several goals [1]: make JavaScript better for complex applications for libraries (possibly including the DOM) as a target of code generators Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 7 / 70
  • 8. Challenges of evolving a web language Little control over ECMAScript versions: 1 Browsers: encounter code in many different versions. Even within a single app (third party code!). 2 Apps: encounter engines supporting a variety of versions. Constraints for ECMAScript 6: #1 ⇒ Must not break existing code. #2 ⇒ Can’t be used right away (not everywhere). Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 8 / 70
  • 9. Challenges of evolving a web language don’t break existing code add new features fix pitfalls preserve nature of JavaScript Goals Requirements Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 9 / 70
  • 10. How features are designed Avoid “design by committee”: Design by “champions” (groups of 1–2 experts) Feedback from TC39 and the web community TC39 has final word on whether to include Stages [2]: Strawman proposal TC39 is interested ⇒ proposal Field-testing via one or more implementations, refinements TC39 accepts feature ⇒ included in ECMAScript draft Included in final spec ⇒ Standard Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 10 / 70
  • 12. Block-scoped variables Function scope (var) function order(x, y) { console.log(tmp); // undefined if (x > y) { var tmp = x; x = y; y = tmp; } return [x, y]; } Block scope (let, const) function order(x, y) { console.log(tmp); // ReferenceError: // tmp is not defined if (x > y) { let tmp = x; x = y; y = tmp; } return [x, y]; } Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 12 / 70
  • 13. Destructuring: objects Extract data (more than one value!) via patterns: let obj = { first: 'Jane', last: 'Doe' }; let { first: f , last: l } = obj; console.log(f + ' ' + l); // Jane Doe let { first, last } = obj; // same as { first: first , last: last } console.log(first + ' ' + last); // Jane Doe Usage: variable declarations, assignments, parameter definitions. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 13 / 70
  • 14. Destructuring: arrays let [x, y] = [ 'a', 'b' ]; // x='a', y='b' let [x, y] = [ 'a', 'b', 'c', 'd' ]; // x='a', y='b' let [x, y, ...rest] = [ 'a', 'b', 'c', 'd' ]; // x='a', y='b', rest = [ 'c', 'd' ] [x,y] = [y,x]; Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 14 / 70
  • 15. Destructuring: refutable by default Refutable (default): exception if match isn’t exact. { a: x, b: y } = { a: 3 }; // fails Irrefutable: always match. { a: x, ?b: y } = { a: 3 }; // x=3, y=undefined Default value: use if no match or value is undefined { a: x, b: y=5 } = { a: 3 }; // x=3, y=5 Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 15 / 70
  • 17. Arrow functions: less to type Compare: let squares = [1, 2, 3].map(x => x * x); let squares = [1, 2, 3].map(function (x) {return x * x}); Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 17 / 70
  • 18. Arrow functions: lexical this, no more that=this function UiComponent { var that = this; var button = document.getElementById('#myButton'); button.addEventListener('click', function () { console.log('CLICK'); that.handleClick(); }); } UiComponent.prototype.handleClick = function () { ... }; function UiComponent { let button = document.getElementById('#myButton'); button.addEventListener('click', () => { console.log('CLICK'); this.handleClick(); }); } Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 18 / 70
  • 19. Arrow functions: variants Zero parameters: () => expr () => { stmt0; stmt1; ... } One parameter: arg => expr arg => { stmt0; stmt1; ... } More than one parameter: (arg0, arg1, ...) => expr (arg0, arg1, ...) => { stmt0; stmt1; ... } Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 19 / 70
  • 20. Parameter handling 1: parameter default values Give missing parameters a default value. function func1(x, y=3) { return [x,y]; } Interaction: > func1(1, 2) [1, 2] > func1(1) [1, 3] > func1() [undefined, 3] Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 20 / 70
  • 21. Parameter handling 2: rest parameters Put trailing parameters in an array. function func2(arg0, ...others) { return others; } Interaction: > func2(0, 1, 2, 3) [1, 2, 3] > func2(0) [] > func2() [] Eliminate the need for the special variable arguments. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 21 / 70
  • 22. Parameter handling 3: named parameters Idea: name parameters via an object literal. More descriptive: moveTo({ x: 50, y: 50, speed: 0.5 }) Easy to omit: foo({ opt1: 'a', opt2: 'b', opt3: 'c' }) foo({ opt3: 'c' }) foo({ opt1: 'a', opt3: 'c' }) Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 22 / 70
  • 23. Parameter handling 3: named parameters Use destructuring for named parameters opt1 and opt2: function func3(arg0, { opt1, opt2 }) { return return [opt1, opt2]; } Interaction: > func3(0, { opt1: 'a', opt2: 'b' }) ['a', 'b'] Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 23 / 70
  • 24. Spread operator (...) Turn an array into function/method arguments: > Math.max(7, 4, 11) 11 > Math.max(...[7, 4, 11]) 11 The inverse of a rest parameter Mostly replaces Function.prototype.apply() Also works in constructors Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 24 / 70
  • 26. Object literals // ECMAScript 6 let obj = { __proto__: someObject, // special property myMethod(arg1, arg2) { // method definition ... } }; // ECMAScript 5 var obj = Object.create(someObject); obj.myMethod = function (arg1, arg2) { ... }; Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 26 / 70
  • 27. Object literals: property value shorthand Shorthand: {x,y} is the same as { x: x, y: y }. function computePoint() { let x = computeX(); let y = computeY(); return { x, y }; // shorthand } let {x,y} = computePoint(); // shorthand Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 27 / 70
  • 28. Symbols Each symbol is a unique value. Use as enum-style values property keys: let sym = Symbol(); console.log(typeof sym); // symbol let obj = { [sym](arg) { // computed property key ... } }; obj[sym](123); Advantages of symbols as property keys: No name clashes! Configure various aspects of the language ⇒ import public symbols from a system module Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 28 / 70
  • 29. Classes class Point { constructor(x, y) { this.x = x; this.y = y; } toString() { return '('+this.x+', '+this.y+')'; } } function Point(x, y) { this.x = x; this.y = y; } Point.prototype.toString = function () { return '('+this.x+', '+this.y+')'; }; Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 29 / 70
  • 30. Classes: sub-type class ColorPoint extends Point { constructor(x, y, color) { super(x, y); // same as super.constructor(x, y) this.color = color; } toString() { return this.color+' '+super(); } } function ColorPoint(x, y, color) { Point.call(this, x, y); this.color = color; } ColorPoint.prototype = Object.create(Point.prototype); ColorPoint.prototype.constructor = ColorPoint; ColorPoint.prototype.toString = function () { return this.color+' '+Point.prototype.toString.call(this); }; Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 30 / 70
  • 31. Static methods class Point { static zero() { return new Point(0, 0); } constructor(x, y) { this.x = x; this.y = y; } } let p = Point.zero(); Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 31 / 70
  • 32. Private properties Hiding some properties from external access (object literals, classes): Still under discussion. But there will be some way of doing it. Possibly: a special kind of symbol. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 32 / 70
  • 33. Modules: overview // lib/math.js let notExported = 'abc'; export function square(x) { return x * x; } export const MY_CONSTANT = 123; // main.js import {square} from 'lib/math'; console.log(square(3)); Alternatively: import 'lib/math' as math; console.log(math.square(3)); Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 33 / 70
  • 34. Modules: features More features [3]: Rename imports Concatenation: put several modules in the same file Module IDs are configurable (default: paths relative to importing file) Programmatic (e.g. conditional) loading of modules via an API Module loading is customizable: Automatic linting Automatically translate files (CoffeeScript, TypeScript) Use legacy modules (AMD, Node.js) Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 34 / 70
  • 36. Iterables and iterators [iterate]() ... Iterable: traversable data structure next() Iterator: pointer for traversing iterable returns Examples of iterables: Arrays Results produced by tool functions and methods (keys(), values(), entries()). Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 36 / 70
  • 37. Iterators import {iterate} from '@iter'; // symbol function iterArray(arr) { let i = 0; return { // both iterable and iterator [iterate]() { // iterable return this; // iterator }, next() { // iterator if (i < arr.length) { return { value: arr[i++] }; } else { return { done: true }; } } } } for (let elem of iterArray(['a', 'b'])) { console.log(elem); } Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 37 / 70
  • 38. for-of: a better loop for-in loop: Basically useless for arrays Quirky for objects Array.prototype.forEach(): doesn’t work with iterables. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 38 / 70
  • 39. for-of loop: arrays Looping over iterables. let arr = [ 'hello', 'world' ]; for (let elem of arr) { console.log(elem); } Output: hello world Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 39 / 70
  • 40. for-of loop: objects let obj = { first: 'Jane', last: 'Doe' }; Iterate over properties: import {entries} from '@iter'; // returns an iterable for (let [key, value] of entries(obj)) { console.log(key + ' = ' + value); } Iterate over property names: import {keys} from '@iter'; // returns an iterable for (let name of keys(obj)) { console.log(name); } Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 40 / 70
  • 42. Template strings: string interpolation Invocation: templateHandler`Hello ${firstName} ${lastName}!` Syntactic sugar for: templateHandler(['Hello ', ' ', '!'], firstName, lastName) Two kinds of tokens: Literal sections (static): 'Hello' Substitutions (dynamic): firstName Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 42 / 70
  • 43. Template strings: raw strings No escaping, multiple lines: var str = raw`This is a text with multiple lines. Escapes are not interpreted, n is not a newline.`; Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 43 / 70
  • 44. Template strings: regular expressions ECMAScript 5 (XRegExp library): var str = '/2012/10/Page.html'; var parts = str.match(XRegExp( '^ # match at start of string only n' + '/ (?<year> [^/]+ ) # capture top dir as year n' + '/ (?<month> [^/]+ ) # capture subdir as month n' + '/ (?<title> [^/]+ ) # file name base n' + '.html? # file name extension: .htm or .html n' + '$ # end of string', 'x' )); console.log(parts.year); // 2012 XRegExp features: named groups, ignored whitespace, comments. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 44 / 70
  • 45. Template strings: regular expressions ECMAScript 6: let str = '/2012/10/Page.html'; let parts = str.match(XRegExp.rx` ^ # match at start of string only / (?<year> [^/]+ ) # capture top dir as year / (?<month> [^/]+ ) # capture subdir as month / (?<title> [^/]+ ) # file name base .html? # file name extension: .htm or .html $ # end of string `); Advantages: Raw characters: no need to escape backslash and quote Multi-line: no need to concatenate strings with newlines at the end Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 45 / 70
  • 46. Template strings: other use cases Query languages Text localization Secure templates etc. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 46 / 70
  • 48. Maps Data structure mapping from arbitrary values to arbitrary values (objects: keys must be strings). let map = new Map(); let obj = {}; map.set(obj, 123); console.log(map.get(obj)); // 123 console.log(map.has(obj)); // true map.delete(obj); console.log(map.has(obj)); // false Also: iteration (over keys, values, entries) and more. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 48 / 70
  • 49. Weak maps Idea – a map with weakly held keys: Map objects to data. Don’t prevent objects from being garbage-collected. Use cases: privately associating data with objects, private caches, . . . Constraints: Can’t enumerate contents Keys are objects, values are arbitrary values Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 49 / 70
  • 50. Sets A collection of values without duplicates. let set1 = new Set(); set1.add('hello'); console.log(set1.has('hello')); // true console.log(set1.has('world')); // false let set2 = new Set([3,2,1,3,2,3]); console.log(set2.values()); // 1,2,3 Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 50 / 70
  • 51. Object.assign Merge one object into another one. class Point { constructor(x, y) { Object.assign(this, { x, y }); } } Similar to Underscore.js _.extend(). Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 51 / 70
  • 52. Various other additions to the standard library > 'abc'.repeat(3) 'abcabcabc' > 'abc'.startsWith('ab') true > 'abc'.endsWith('bc') true And more! Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 52 / 70
  • 54. function* generatorFunction() { ... yield x; ... } generatorObject returns next() yield next() yield Generators: suspend and resume a function Shallow coroutines [4]: only function body is suspended. Uses: iterators, simpler asynchronous programming. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 54 / 70
  • 55. Generators: example Suspend via yield (“resumable return”): function* generatorFunction() { yield 0; yield 1; yield 2; } Start and resume via next(): let genObj = generatorFunction(); console.log(genObj.next()); // 0 console.log(genObj.next()); // 1 console.log(genObj.next()); // 2 Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 55 / 70
  • 56. Generators: implementing an iterator An iterator for nested arrays: function* iterTree(tree) { if (Array.isArray(tree)) { // inner node for(let i=0; i < tree.length; i++) { yield* iterTree(tree[i]); // recursion } } else { // leaf yield tree; } } Difficult to write without recursion. Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 56 / 70
  • 57. Generators: asynchronous programming Using the task.js library: spawn(function* () { try { var [foo, bar] = yield join( read("foo.json") , read("bar.json") ).timeout(1000); render(foo); render(bar); } catch (e) { console.log("read failed: " + e); } }); Wait for asynchronous calls via yield (internally based on promises). Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 57 / 70
  • 59. Proxies Observe operations applied to object proxy, via handler h: let target = {}; let proxy = Proxy(target, h); Each of the following operations triggers a method invocation on h: proxy['foo'] → h.get(target, 'foo', p) proxy['foo'] = 123 → h.set(target, 'foo', 123, p) 'foo' in proxy → h.has(target, 'foo') for (key in proxy) {...} → h.enumerate(target) Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 59 / 70
  • 60. Proxies in the prototype chain let child = Object.create(proxy); Operations on child can still trigger handler invocations (if the search for properties reaches proxy): child['foo'] → h.get(target, 'foo', ch) child['foo'] = 123 → h.set(target, 'foo', 123, ch) 'foo' in child → h.has(target, 'foo') for (key in child) {...} → h.enumerate(target) Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 60 / 70
  • 61. Proxy: example let handler = { get(target, name, receiver) { return (...args) => { console.log('Missing method '+name + ', arguments: '+args); } } }; let proxy = Proxy({}, handler); Using the handler: > let obj = Object.create(proxy); > obj.foo(1, 2) Missing method foo, arguments: 1, 2 undefined Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 61 / 70
  • 62. Use cases for proxies Typical meta-programming tasks: Sending all method invocations to a remote object Implementing data access objects for a database Data binding Logging Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 62 / 70
  • 64. Time table ECMAScript specification: November 2013: final review of draft July 2014: editorially complete December 2014: Ecma approval Features are already appearing in JavaScript engines [5]! Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 64 / 70
  • 66. References 1 ECMAScript Harmony wiki 2 “The Harmony Process” by David Herman 3 “ES6 Modules” by Yehuda Katz 4 “Why coroutines won’t work on the web” by David Herman 5 “ECMAScript 6 compatibility table” by kangax [features already in JavaScript engines] Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 66 / 70
  • 67. Resources ECMAScript 6 specification drafts by Allen Wirfs-Brock ECMAScript mailing list: es-discuss TC39 meeting notes by Rick Waldron “A guide to 2ality’s posts on ECMAScript 6” by Axel Rauschmayer Continuum, an ECMAScript 6 virtual machine written in ECMAScript 3. (Links are embedded in this slide.) Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 67 / 70
  • 69. Function-scoping: pitfall function foo() { var x = 3; if (x >= 0) { var tmp; console.log(tmp); // undefined tmp = 'abc'; } if (x > 0) { var tmp; console.log(tmp); // abc } } Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 69 / 70
  • 70. Comprehensions Array comprehensions produce an array: let numbers = [1,2,3]; let squares = [for (x of numbers) x*x]; Generator comprehensions produce a generator object (an iterator): let squares = (for (x of numbers) x*x); Dr. Axel Rauschmayer (rauschma.de) ECMAScript 6 2013-03-30 70 / 70