system, • optional type annotations and static typing, probably using a structural type system, • generators and iterators, • destructuring assignment • algebraic data types. • … • abandoned in July 2008!
champion(s), including one TC39 member • Spec: prose, example, API, semantics and algorythms • Some implementation: polyfills and demos • Changes are still expected
ES spec • Required • Test262 acceptance tests (performance tests, more then 11000 as of 2013) • Practical experience • Editor must sign off on the spec text • Will be included in next version of standard
and atomics (Lars T. Hansen) • Object.values/Object.entries (Jordan Harband) • String padding (Jordan Harband, Rick Waldron) • Object.getOwnPropertyDescriptors() (Jordan Harband, Andrea • Giammarchi) • Trailing commas in function parameter lists and calls (Jeff Morrison)
asynchronicity via callbacks • Web Workers • Originally: copy and send strings • Structured cloning: copy and send structured data • Transferables: move and send structured data
const worker = new Worker(‘worker.js'); // To be shared const sharedBuffer = new SharedArrayBuffer( 10 * Int32Array.BYTES_PER_ELEMENT); // Share sharedBuffer with the worker worker.postMessage({sharedBuffer}); // clone // Local only const sharedArray = new Int32Array(sharedBuffer);
while (sharedArray[0] === 1) ; // turns into let tmp = sharedArray[0]; while (tmp === 1) ; // runs never or forever // Writes may be reorderer // main.js sharedArray[1] = 11; sharedArray[2] = 22; // worker.js while (sharedArray[2] !== 22) ; console.log(sharedArray[1]); // 0 or 11
Code splitting: load parts of your program on demand. • Conditional loading of modules: if (cond) { import(···).then(···) } • Computed module specifiers: import('module'+count).then(···)
readLinesAsync(fileName)) { console.log(l); } async function f() { const aI = createAsyncIterable(['a', 'b']); for await (const x of aI) { console.log(x); } } // Output: // a // b • Works inside: • Async functions • Async generators (new)
• Return source code whenever possible • Previously: optional • Otherwise: standardised placeholder • Previously: must cause SyntaxError (no guarantee)
data const a = SIMD.Float32x4(1.0, 2.0, 3.0, 4.0); const b = SIMD.Float32x4(5.0, 6.0, 7.0, 8.0); const c = SIMD.Float32x4.add(a,b); • Big integers const x = BigInt.asUintN(64, 1234n); const y = BigInt.asUintN(64, 5678n); const result = BigInt.asUintN(64, x*y);