SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler offline
Talk, by Allen Wirfs-Brock
Mozilla Research Fellow
Project Editor, Ecma-262 (The JavaScript Standard)
@awbjs
ECMAScript 6:
A Better JavaScript for the
Ambient Computing Era
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
Each Computing Era has had Canonical
Programming Languages
• Corporate Computing Era – COBOL/Fortran
• Personal Computing Era – C/C++ family
• Ambient Computing Era – JavaScript ??
Why JavaScript?
The economics of ubiquity.
 It’s already there
 Widest reach
 Lowest risk
 Write libraries and apps once
 Single knowledge and skill set http://odetocode.com/Blogs/scott/archive/2009/03/18/signs-that-your-javascript-skills-need-updating.aspx
Because “Worse is Better”Dick Grabriel
http://www.dreamsongs.com/WorseIsBetter.html
Is it even possible to replace it?
How Does JavaScript Evolve?
TENTEN
JavaScript Early history
• May 1995, Created in ten days by Brendan Eich at Netscape:“Mocha”
• September 1995, shipped in beta of Netscape Navigator 2.0:“LiveScript”
• December 1995, Netscape 2.0b3:“JavaScript”
• August 1996, JavaScript cloned in Microsoft IE 3.0:“JScript”
• 1996-1997, Standardization ECMA-262 Ed. 1: ”ECMAScript” aka ES1
• 1999, ES3 modern JS baseline−
What is ECMAScript?
• ECMAScript is the name of the
international standard that defines
JavaScript
• Developed by Technical Committee 39
(TC-39) of Ecma International
• Issued as a Ecma-262 and ISO/IEC 16262
• Not part of W3C
Google Mozilla Microsoft Webkit
V8 SpiderMonkey Chakra JSCore
JavaScript Implementations
ECMAScript:Troubled Adolescence
• 2000: ES4, attempt 1
• 2003-4: E4X, XML extensions for ECMAScript
• 2005-7: ES4, attempt 2
• 2008: ES4 abandoned
• 2009: ES5:“use strict”, JSON, Object.create, etc.
Sept. 2008 http://ejohn.org/blog/javascript-performance-rundown/
JavaScript Performance 2008
Milliseconds
JavaScript Performance 2013
http://www.7tutorials.com/browser-wars-does-internet-explorer-11-deliver-browsing-performance
Milliseconds
The ECMAScript Standard Timeline
ES.next/“Harmony”
“ES4”
E4X
“ES4”
Ecma International Technical Committee 39 (TC39)
Some ECMAScript 6 Enhancements
•More concise and expressive syntax
•Modules and Sanding-boxing
•Class Declarations
•Control abstraction via iterators and generators
•Array comprehensions
•Promises
•String interpolation/Internal DSL support
•Subclassable built-ins
•Binary Array Objects with Array methods
•Built-in hash Maps and Sets + weak variants.
•More built-in Math and String functions
•Improved Unicode support ES 5.1: 250 pages
ES 6 draft: 651 pages
https://github.com/lukehoban/es6features
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
TC-39?: It’s not like this…
Photo by http://www.flickr.com/photos/scmtngirl/ @ flickr (CC BY-NC-ND 2.0)
…and not like this, either
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
ECMAScript Design Challenges
You can never loose the baggage.
The closure-in-loop problem
function f(x) {
for (var p in x) {
var v = doSomething(x,p);
obj.addCallback(
function(args){
handle(v,p, args)
)};
}
}
…
obj.runCallbacks();
var hoisting causes the problem
ES6 can’t redefine the scoping of var
function f(x) {
for (var p in x) {
var v = doSomething(x,p);
if (v === somethingSpecial) break;
}
if (v === somethingSpecial) ...
}
Other local scoping WTFs
function f(x,x) {
var x;
for (var x in obj) {
if (obj[x] === somethingSpecial) {
var x = 0;
...
}
}
function x() { doSomething()}
x();
}
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
Fixing closure-in-loop problem:
Add a new block scoped declaration
Want to avoid new let WTFs
//duplicate declarations
function f() {
let x = 1;
let x = 2;
}
//duplicate let and var
function g() {
let x = 1;
var x = 2;
}
//duplicate let and parameter
function h(x) {
let x = 1;
}
//hoist var to/over let
function ff() {
let x = 1;
if (pred) {
var x;
}
}
//duplicate let and function
function h() {
let x = 1;
function x() {}
}
Avoid inconsistent scoping WTFs
//Forward or outer reference
let x = 1;
function f() {
console.log(x);//1,undefined, error?
let x = 2;
}
Within any block, a name must have single consistent binding.
Dead
zones
for x
And bogus forward references
//Forward reference const
function f() {
console.log(x);//3,error?
const x = 3;
}
//Forward reference
let x = 1;
function f() {
x = 2;
console.log(x);//2, 3,undefined, error?
let x = 3;
}
Some forward references are desirable
//Forward reference
let x = 1;
function f() {
const r1 = function(n) {n>0?r2(n-1):0}
const r2 = function(n) {n>0?r1(n-1):0}
r1(10);
}
Static dead zones
are too restrictive
Temporal Dead Zones:
•Error based upon time of actual access
•Not upon position in source code
•Must be initialized prior to access or assignment
Some ES6 Declaration Rules
• Single unique binding for any name in a scope.
• Multiple var and top-level function declarations for the same name are
allowed. (Still one binding per name) Just like ES1-5
• All other multiple declarations are errors: var/let, let/let, let/const, class/function,
etc.
• var declarations hoist to top level and auto initialized to undefined. Just like ES1-
5
• Can’t hoist a var over any other declaration of same name (except a top-level
function)
• Runtime error, for accessing or assigning to an uninitialized binding
• let, const, class declarations are dead until initialized (TDZ).
What about Block Scoped Functions?
//block scoped function
function f() {
if (pred) {
function g() {}
}
g( );
}
//duplicate declarations
function f() {
if (pred) {
function g() {}
g( );
function g() {}
}
}
Why not, ECMAScript 1-5 didn’t allow function declarations in blocks.
But real browsers agree...
//block scoped function?
function f() {
if (pred) {
function g() {}
g( );
}
}
and real browsers, disagree...
function f() {
g( ); //is g defined?
if (pred) {
function g() {}
g( );
}
}
function f() {
if (pred) {
function g() {}
g( ); //which g??
}
function g() {}
}
Disagreement on non-standard features is an standardization opportunity.
Unfortunately, all browsers agree:
//block scoped function?
function f() {
if (pred) {
function g() {}
g( );
}
g( ); //calls g from block
}
Web interoperability requires leaking some block level function declarations!
What is the common interoperable
browser semantics for block function
declarations?
• A function declared only once in a block can be called from
within the block at any point following the actual declaration.
• A function declared only once in a block, can be referenced
from any point that follows the block in the surrounding
function.
Making block scoped functions compatible
with intersection semantics
function f() {
var g;
function __g(v) {g=v}
if (pred) {
function g() {}
__g(g);
}
g( );
}
function f() {
if (pred) {
function g() {}
}
g();
}
As if
But only if treating the function declaration as a
hoisted var declaration would not be an error.
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
• It’s real
• It’s feature complete
• It’s being implemented in
your favorite bowers right
now
ECMAScript 6
ECMAScript Resources
The Official ECMAScript 5.1 Specification (HTML)
http://www.ecma-international.org/ecma-262/5.1/
ES6 Specification Drafts
http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts
ES6 Feature Summary
https://github.com/lukehoban/es6features
ES6 translators and tools
https://github.com/addyosmani/es6-tools
TheTC-39 ECMAScript Design Discussion Mail List
https://mail.mozilla.org/listinfo/es-discuss
Test262:The Offical ECMAScript ImplementationTest Suite
http://test262.ecmascript.org/
Please report bugs
http://bugs.ecmascript.org

Mais conteúdo relacionado

Mais procurados

ES6 PPT FOR 2016
ES6 PPT FOR 2016ES6 PPT FOR 2016
ES6 PPT FOR 2016Manoj Kumar
 
An Intro To ES6
An Intro To ES6An Intro To ES6
An Intro To ES6FITC
 
JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016Codemotion
 
Proxies are Awesome!
Proxies are Awesome!Proxies are Awesome!
Proxies are Awesome!Brendan Eich
 
React Native Evening
React Native EveningReact Native Evening
React Native EveningTroy Miles
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot CampTroy Miles
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionDmitry Sheiko
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)Domenic Denicola
 
LINQ Inside
LINQ InsideLINQ Inside
LINQ Insidejeffz
 
Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring ClojurescriptLuke Donnet
 
The algebra of library design
The algebra of library designThe algebra of library design
The algebra of library designLeonardo Borges
 
React Native One Day
React Native One DayReact Native One Day
React Native One DayTroy Miles
 
Functional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsFunctional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsLeonardo Borges
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinAndrey Breslav
 
A deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio moduleA deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio moduleSaúl Ibarra Corretgé
 
Letswift19-clean-architecture
Letswift19-clean-architectureLetswift19-clean-architecture
Letswift19-clean-architectureJung Kim
 
Callbacks and control flow in Node js
Callbacks and control flow in Node jsCallbacks and control flow in Node js
Callbacks and control flow in Node jsThomas Roch
 

Mais procurados (20)

ES6 PPT FOR 2016
ES6 PPT FOR 2016ES6 PPT FOR 2016
ES6 PPT FOR 2016
 
An Intro To ES6
An Intro To ES6An Intro To ES6
An Intro To ES6
 
JavaScript ES6
JavaScript ES6JavaScript ES6
JavaScript ES6
 
ES6 in Real Life
ES6 in Real LifeES6 in Real Life
ES6 in Real Life
 
JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016
 
Proxies are Awesome!
Proxies are Awesome!Proxies are Awesome!
Proxies are Awesome!
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)
 
LINQ Inside
LINQ InsideLINQ Inside
LINQ Inside
 
Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring Clojurescript
 
The algebra of library design
The algebra of library designThe algebra of library design
The algebra of library design
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
 
Functional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsFunctional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event Systems
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in Kotlin
 
A deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio moduleA deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio module
 
Letswift19-clean-architecture
Letswift19-clean-architectureLetswift19-clean-architecture
Letswift19-clean-architecture
 
Kotlin
KotlinKotlin
Kotlin
 
Callbacks and control flow in Node js
Callbacks and control flow in Node jsCallbacks and control flow in Node js
Callbacks and control flow in Node js
 

Destaque

Rachel's grandmother's recipes
Rachel's grandmother's recipesRachel's grandmother's recipes
Rachel's grandmother's recipesEyal Vardi
 
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Eyal Vardi
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptWojciech Dzikowski
 
ES2015 훑어보기 for Django Girls Seoul
ES2015 훑어보기 for Django Girls SeoulES2015 훑어보기 for Django Girls Seoul
ES2015 훑어보기 for Django Girls SeoulHyeonMi Kim
 
Es2015 Simple Overview
Es2015 Simple OverviewEs2015 Simple Overview
Es2015 Simple OverviewKim Hunmin
 
Expert Days 2012 - Tracks
Expert Days 2012 - TracksExpert Days 2012 - Tracks
Expert Days 2012 - TracksEyal Vardi
 
Подробная презентация JavaScript 6 в 1
Подробная презентация JavaScript 6 в 1Подробная презентация JavaScript 6 в 1
Подробная презентация JavaScript 6 в 1Vasya Petrov
 
AddConf. Дмитрий Сошников - Будущее ECMAScript
AddConf. Дмитрий Сошников  - Будущее ECMAScriptAddConf. Дмитрий Сошников  - Будущее ECMAScript
AddConf. Дмитрий Сошников - Будущее ECMAScriptDmitry Soshnikov
 
"Готовим промисы правильно", Андрей Яманов, MoscowJS 24
"Готовим промисы правильно", Андрей Яманов, MoscowJS 24"Готовим промисы правильно", Андрей Яманов, MoscowJS 24
"Готовим промисы правильно", Андрей Яманов, MoscowJS 24MoscowJS
 
Обзор ES2015(ES6)
Обзор ES2015(ES6)Обзор ES2015(ES6)
Обзор ES2015(ES6)Alex Filatov
 
DevConf. Дмитрий Сошников - ECMAScript 6
DevConf. Дмитрий Сошников - ECMAScript 6DevConf. Дмитрий Сошников - ECMAScript 6
DevConf. Дмитрий Сошников - ECMAScript 6Dmitry Soshnikov
 
JavaScript-модули "из прошлого в будущее"
JavaScript-модули "из прошлого в будущее"JavaScript-модули "из прошлого в будущее"
JavaScript-модули "из прошлого в будущее"oelifantiev
 
Ecma script 6 in action
Ecma script 6 in actionEcma script 6 in action
Ecma script 6 in actionYuri Trukhin
 
"Как написать компилятор за 15 минут", Андрей Гершун, MoscowJS 24
"Как написать компилятор за 15 минут", Андрей Гершун, MoscowJS 24"Как написать компилятор за 15 минут", Андрей Гершун, MoscowJS 24
"Как написать компилятор за 15 минут", Андрей Гершун, MoscowJS 24MoscowJS
 
Introducing Razor - A new view engine for ASP.NET
Introducing Razor - A new view engine for ASP.NET Introducing Razor - A new view engine for ASP.NET
Introducing Razor - A new view engine for ASP.NET Shiju Varghese
 
Razor and the Art of Templating
Razor and the Art of TemplatingRazor and the Art of Templating
Razor and the Art of TemplatingJess Chadwick
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 
Дэвид Флэнаган — Javascript (5 издание)
Дэвид Флэнаган — Javascript (5 издание)Дэвид Флэнаган — Javascript (5 издание)
Дэвид Флэнаган — Javascript (5 издание)mlatushko
 

Destaque (20)

Rachel's grandmother's recipes
Rachel's grandmother's recipesRachel's grandmother's recipes
Rachel's grandmother's recipes
 
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern Javascript
 
ES2015 훑어보기 for Django Girls Seoul
ES2015 훑어보기 for Django Girls SeoulES2015 훑어보기 for Django Girls Seoul
ES2015 훑어보기 for Django Girls Seoul
 
Es2015 Simple Overview
Es2015 Simple OverviewEs2015 Simple Overview
Es2015 Simple Overview
 
Expert Days 2012 - Tracks
Expert Days 2012 - TracksExpert Days 2012 - Tracks
Expert Days 2012 - Tracks
 
Подробная презентация JavaScript 6 в 1
Подробная презентация JavaScript 6 в 1Подробная презентация JavaScript 6 в 1
Подробная презентация JavaScript 6 в 1
 
AddConf. Дмитрий Сошников - Будущее ECMAScript
AddConf. Дмитрий Сошников  - Будущее ECMAScriptAddConf. Дмитрий Сошников  - Будущее ECMAScript
AddConf. Дмитрий Сошников - Будущее ECMAScript
 
"Готовим промисы правильно", Андрей Яманов, MoscowJS 24
"Готовим промисы правильно", Андрей Яманов, MoscowJS 24"Готовим промисы правильно", Андрей Яманов, MoscowJS 24
"Готовим промисы правильно", Андрей Яманов, MoscowJS 24
 
Обзор ES2015(ES6)
Обзор ES2015(ES6)Обзор ES2015(ES6)
Обзор ES2015(ES6)
 
доклад
докладдоклад
доклад
 
DevConf. Дмитрий Сошников - ECMAScript 6
DevConf. Дмитрий Сошников - ECMAScript 6DevConf. Дмитрий Сошников - ECMAScript 6
DevConf. Дмитрий Сошников - ECMAScript 6
 
JavaScript-модули "из прошлого в будущее"
JavaScript-модули "из прошлого в будущее"JavaScript-модули "из прошлого в будущее"
JavaScript-модули "из прошлого в будущее"
 
Ecma script 6 in action
Ecma script 6 in actionEcma script 6 in action
Ecma script 6 in action
 
"Как написать компилятор за 15 минут", Андрей Гершун, MoscowJS 24
"Как написать компилятор за 15 минут", Андрей Гершун, MoscowJS 24"Как написать компилятор за 15 минут", Андрей Гершун, MoscowJS 24
"Как написать компилятор за 15 минут", Андрей Гершун, MoscowJS 24
 
Introducing Razor - A new view engine for ASP.NET
Introducing Razor - A new view engine for ASP.NET Introducing Razor - A new view engine for ASP.NET
Introducing Razor - A new view engine for ASP.NET
 
Razor and the Art of Templating
Razor and the Art of TemplatingRazor and the Art of Templating
Razor and the Art of Templating
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
 
Views
ViewsViews
Views
 
Дэвид Флэнаган — Javascript (5 издание)
Дэвид Флэнаган — Javascript (5 издание)Дэвид Флэнаган — Javascript (5 издание)
Дэвид Флэнаган — Javascript (5 издание)
 

Semelhante a ECMAScript 6: A Better JavaScript for the Ambient Computing Era

Blocks & GCD
Blocks & GCDBlocks & GCD
Blocks & GCDrsebbe
 
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra  SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra Sencha
 
Dmytro Kochergin Angular 2 and New Java Script Technologies
Dmytro Kochergin Angular 2 and New Java Script TechnologiesDmytro Kochergin Angular 2 and New Java Script Technologies
Dmytro Kochergin Angular 2 and New Java Script TechnologiesLogeekNightUkraine
 
Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Asher Martin
 
Java day2016 "Reinventing design patterns with java 8"
Java day2016 "Reinventing design patterns with java 8"Java day2016 "Reinventing design patterns with java 8"
Java day2016 "Reinventing design patterns with java 8"Alexander Pashynskiy
 
Construction Techniques For Domain Specific Languages
Construction Techniques For Domain Specific LanguagesConstruction Techniques For Domain Specific Languages
Construction Techniques For Domain Specific LanguagesThoughtWorks
 
Why scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisWhy scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisRuslan Shevchenko
 
Jslab rssh: JS as language platform
Jslab rssh:  JS as language platformJslab rssh:  JS as language platform
Jslab rssh: JS as language platformRuslan Shevchenko
 
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"JSLab.Руслан Шевченко."JavaScript как платформа компиляции"
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"GeeksLab Odessa
 
Swimat - Swift formatter
Swimat - Swift formatterSwimat - Swift formatter
Swimat - Swift formatterJintin Lin
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019corehard_by
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVMJung Kim
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationAjax Experience 2009
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)JiandSon
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPrashant Rane
 

Semelhante a ECMAScript 6: A Better JavaScript for the Ambient Computing Era (20)

AkJS Meetup - ES6++
AkJS Meetup -  ES6++AkJS Meetup -  ES6++
AkJS Meetup - ES6++
 
Blocks & GCD
Blocks & GCDBlocks & GCD
Blocks & GCD
 
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra  SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
 
Dmytro Kochergin Angular 2 and New Java Script Technologies
Dmytro Kochergin Angular 2 and New Java Script TechnologiesDmytro Kochergin Angular 2 and New Java Script Technologies
Dmytro Kochergin Angular 2 and New Java Script Technologies
 
Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3
 
Java day2016 "Reinventing design patterns with java 8"
Java day2016 "Reinventing design patterns with java 8"Java day2016 "Reinventing design patterns with java 8"
Java day2016 "Reinventing design patterns with java 8"
 
Construction Techniques For Domain Specific Languages
Construction Techniques For Domain Specific LanguagesConstruction Techniques For Domain Specific Languages
Construction Techniques For Domain Specific Languages
 
Why scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisWhy scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with this
 
Jslab rssh: JS as language platform
Jslab rssh:  JS as language platformJslab rssh:  JS as language platform
Jslab rssh: JS as language platform
 
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"JSLab.Руслан Шевченко."JavaScript как платформа компиляции"
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"
 
Swimat - Swift formatter
Swimat - Swift formatterSwimat - Swift formatter
Swimat - Swift formatter
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
 
Play framework
Play frameworkPlay framework
Play framework
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus Presentation
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
 
New features in Ruby 2.5
New features in Ruby 2.5New features in Ruby 2.5
New features in Ruby 2.5
 

Último

Unlocking AI: Navigating Open Source vs. Commercial Frontiers
Unlocking AI:Navigating Open Source vs. Commercial FrontiersUnlocking AI:Navigating Open Source vs. Commercial Frontiers
Unlocking AI: Navigating Open Source vs. Commercial FrontiersRaphaël Semeteys
 
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...Splashtop Inc
 
VuNet software organisation powerpoint deck
VuNet software organisation powerpoint deckVuNet software organisation powerpoint deck
VuNet software organisation powerpoint deckNaval Singh
 
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...Maxim Salnikov
 
renewable energy renewable energy renewable energy renewable energy
renewable energy renewable energy renewable energy  renewable energyrenewable energy renewable energy renewable energy  renewable energy
renewable energy renewable energy renewable energy renewable energyjeyasrig
 
Leveling Up your Branding and Mastering MERN: Fullstack WebDev
Leveling Up your Branding and Mastering MERN: Fullstack WebDevLeveling Up your Branding and Mastering MERN: Fullstack WebDev
Leveling Up your Branding and Mastering MERN: Fullstack WebDevpmgdscunsri
 
8 key point on optimizing web hosting services in your business.pdf
8 key point on optimizing web hosting services in your business.pdf8 key point on optimizing web hosting services in your business.pdf
8 key point on optimizing web hosting services in your business.pdfOffsiteNOC
 
8 Steps to Build a LangChain RAG Chatbot.
8 Steps to Build a LangChain RAG Chatbot.8 Steps to Build a LangChain RAG Chatbot.
8 Steps to Build a LangChain RAG Chatbot.Ritesh Kanjee
 
Mobile App Development process | Expert Tips
Mobile App Development process | Expert TipsMobile App Development process | Expert Tips
Mobile App Development process | Expert Tipsmichealwillson701
 
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptx
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptxCYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptx
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptxBarakaMuyengi
 
MinionLabs_Mr. Gokul Srinivas_Young Entrepreneur
MinionLabs_Mr. Gokul Srinivas_Young EntrepreneurMinionLabs_Mr. Gokul Srinivas_Young Entrepreneur
MinionLabs_Mr. Gokul Srinivas_Young EntrepreneurPriyadarshini T
 
BATbern52 Swisscom's Journey into Data Mesh
BATbern52 Swisscom's Journey into Data MeshBATbern52 Swisscom's Journey into Data Mesh
BATbern52 Swisscom's Journey into Data MeshBATbern
 
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...MyFAA
 
Enterprise Content Managements Solutions
Enterprise Content Managements SolutionsEnterprise Content Managements Solutions
Enterprise Content Managements SolutionsIQBG inc
 
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of SimplicityLarge Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of SimplicityRandy Shoup
 
User Experience Designer | Kaylee Miller Resume
User Experience Designer | Kaylee Miller ResumeUser Experience Designer | Kaylee Miller Resume
User Experience Designer | Kaylee Miller ResumeKaylee Miller
 
Technical improvements. Reasons. Methods. Estimations. CJ
Technical improvements.  Reasons. Methods. Estimations. CJTechnical improvements.  Reasons. Methods. Estimations. CJ
Technical improvements. Reasons. Methods. Estimations. CJpolinaucc
 
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...jackiepotts6
 
openEuler Community Overview - a presentation showing the current scale
openEuler Community Overview - a presentation showing the current scaleopenEuler Community Overview - a presentation showing the current scale
openEuler Community Overview - a presentation showing the current scaleShane Coughlan
 

Último (20)

Unlocking AI: Navigating Open Source vs. Commercial Frontiers
Unlocking AI:Navigating Open Source vs. Commercial FrontiersUnlocking AI:Navigating Open Source vs. Commercial Frontiers
Unlocking AI: Navigating Open Source vs. Commercial Frontiers
 
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...
 
20140812 - OBD2 Solution
20140812 - OBD2 Solution20140812 - OBD2 Solution
20140812 - OBD2 Solution
 
VuNet software organisation powerpoint deck
VuNet software organisation powerpoint deckVuNet software organisation powerpoint deck
VuNet software organisation powerpoint deck
 
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
 
renewable energy renewable energy renewable energy renewable energy
renewable energy renewable energy renewable energy  renewable energyrenewable energy renewable energy renewable energy  renewable energy
renewable energy renewable energy renewable energy renewable energy
 
Leveling Up your Branding and Mastering MERN: Fullstack WebDev
Leveling Up your Branding and Mastering MERN: Fullstack WebDevLeveling Up your Branding and Mastering MERN: Fullstack WebDev
Leveling Up your Branding and Mastering MERN: Fullstack WebDev
 
8 key point on optimizing web hosting services in your business.pdf
8 key point on optimizing web hosting services in your business.pdf8 key point on optimizing web hosting services in your business.pdf
8 key point on optimizing web hosting services in your business.pdf
 
8 Steps to Build a LangChain RAG Chatbot.
8 Steps to Build a LangChain RAG Chatbot.8 Steps to Build a LangChain RAG Chatbot.
8 Steps to Build a LangChain RAG Chatbot.
 
Mobile App Development process | Expert Tips
Mobile App Development process | Expert TipsMobile App Development process | Expert Tips
Mobile App Development process | Expert Tips
 
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptx
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptxCYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptx
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptx
 
MinionLabs_Mr. Gokul Srinivas_Young Entrepreneur
MinionLabs_Mr. Gokul Srinivas_Young EntrepreneurMinionLabs_Mr. Gokul Srinivas_Young Entrepreneur
MinionLabs_Mr. Gokul Srinivas_Young Entrepreneur
 
BATbern52 Swisscom's Journey into Data Mesh
BATbern52 Swisscom's Journey into Data MeshBATbern52 Swisscom's Journey into Data Mesh
BATbern52 Swisscom's Journey into Data Mesh
 
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...
 
Enterprise Content Managements Solutions
Enterprise Content Managements SolutionsEnterprise Content Managements Solutions
Enterprise Content Managements Solutions
 
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of SimplicityLarge Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
 
User Experience Designer | Kaylee Miller Resume
User Experience Designer | Kaylee Miller ResumeUser Experience Designer | Kaylee Miller Resume
User Experience Designer | Kaylee Miller Resume
 
Technical improvements. Reasons. Methods. Estimations. CJ
Technical improvements.  Reasons. Methods. Estimations. CJTechnical improvements.  Reasons. Methods. Estimations. CJ
Technical improvements. Reasons. Methods. Estimations. CJ
 
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...
 
openEuler Community Overview - a presentation showing the current scale
openEuler Community Overview - a presentation showing the current scaleopenEuler Community Overview - a presentation showing the current scale
openEuler Community Overview - a presentation showing the current scale
 

ECMAScript 6: A Better JavaScript for the Ambient Computing Era

  • 1. Talk, by Allen Wirfs-Brock Mozilla Research Fellow Project Editor, Ecma-262 (The JavaScript Standard) @awbjs ECMAScript 6: A Better JavaScript for the Ambient Computing Era
  • 3. Each Computing Era has had Canonical Programming Languages • Corporate Computing Era – COBOL/Fortran • Personal Computing Era – C/C++ family • Ambient Computing Era – JavaScript ??
  • 4. Why JavaScript? The economics of ubiquity.  It’s already there  Widest reach  Lowest risk  Write libraries and apps once  Single knowledge and skill set http://odetocode.com/Blogs/scott/archive/2009/03/18/signs-that-your-javascript-skills-need-updating.aspx Because “Worse is Better”Dick Grabriel http://www.dreamsongs.com/WorseIsBetter.html Is it even possible to replace it?
  • 7. JavaScript Early history • May 1995, Created in ten days by Brendan Eich at Netscape:“Mocha” • September 1995, shipped in beta of Netscape Navigator 2.0:“LiveScript” • December 1995, Netscape 2.0b3:“JavaScript” • August 1996, JavaScript cloned in Microsoft IE 3.0:“JScript” • 1996-1997, Standardization ECMA-262 Ed. 1: ”ECMAScript” aka ES1 • 1999, ES3 modern JS baseline−
  • 8. What is ECMAScript? • ECMAScript is the name of the international standard that defines JavaScript • Developed by Technical Committee 39 (TC-39) of Ecma International • Issued as a Ecma-262 and ISO/IEC 16262 • Not part of W3C Google Mozilla Microsoft Webkit V8 SpiderMonkey Chakra JSCore JavaScript Implementations
  • 9. ECMAScript:Troubled Adolescence • 2000: ES4, attempt 1 • 2003-4: E4X, XML extensions for ECMAScript • 2005-7: ES4, attempt 2 • 2008: ES4 abandoned • 2009: ES5:“use strict”, JSON, Object.create, etc.
  • 12. The ECMAScript Standard Timeline ES.next/“Harmony” “ES4” E4X “ES4” Ecma International Technical Committee 39 (TC39)
  • 13. Some ECMAScript 6 Enhancements •More concise and expressive syntax •Modules and Sanding-boxing •Class Declarations •Control abstraction via iterators and generators •Array comprehensions •Promises •String interpolation/Internal DSL support •Subclassable built-ins •Binary Array Objects with Array methods •Built-in hash Maps and Sets + weak variants. •More built-in Math and String functions •Improved Unicode support ES 5.1: 250 pages ES 6 draft: 651 pages https://github.com/lukehoban/es6features
  • 15. TC-39?: It’s not like this…
  • 16. Photo by http://www.flickr.com/photos/scmtngirl/ @ flickr (CC BY-NC-ND 2.0) …and not like this, either
  • 20. You can never loose the baggage.
  • 21. The closure-in-loop problem function f(x) { for (var p in x) { var v = doSomething(x,p); obj.addCallback( function(args){ handle(v,p, args) )}; } } … obj.runCallbacks();
  • 22. var hoisting causes the problem
  • 23. ES6 can’t redefine the scoping of var function f(x) { for (var p in x) { var v = doSomething(x,p); if (v === somethingSpecial) break; } if (v === somethingSpecial) ... }
  • 24. Other local scoping WTFs function f(x,x) { var x; for (var x in obj) { if (obj[x] === somethingSpecial) { var x = 0; ... } } function x() { doSomething()} x(); }
  • 26. Fixing closure-in-loop problem: Add a new block scoped declaration
  • 27. Want to avoid new let WTFs //duplicate declarations function f() { let x = 1; let x = 2; } //duplicate let and var function g() { let x = 1; var x = 2; } //duplicate let and parameter function h(x) { let x = 1; } //hoist var to/over let function ff() { let x = 1; if (pred) { var x; } } //duplicate let and function function h() { let x = 1; function x() {} }
  • 28. Avoid inconsistent scoping WTFs //Forward or outer reference let x = 1; function f() { console.log(x);//1,undefined, error? let x = 2; } Within any block, a name must have single consistent binding.
  • 29. Dead zones for x And bogus forward references //Forward reference const function f() { console.log(x);//3,error? const x = 3; } //Forward reference let x = 1; function f() { x = 2; console.log(x);//2, 3,undefined, error? let x = 3; }
  • 30. Some forward references are desirable //Forward reference let x = 1; function f() { const r1 = function(n) {n>0?r2(n-1):0} const r2 = function(n) {n>0?r1(n-1):0} r1(10); } Static dead zones are too restrictive Temporal Dead Zones: •Error based upon time of actual access •Not upon position in source code •Must be initialized prior to access or assignment
  • 31. Some ES6 Declaration Rules • Single unique binding for any name in a scope. • Multiple var and top-level function declarations for the same name are allowed. (Still one binding per name) Just like ES1-5 • All other multiple declarations are errors: var/let, let/let, let/const, class/function, etc. • var declarations hoist to top level and auto initialized to undefined. Just like ES1- 5 • Can’t hoist a var over any other declaration of same name (except a top-level function) • Runtime error, for accessing or assigning to an uninitialized binding • let, const, class declarations are dead until initialized (TDZ).
  • 32. What about Block Scoped Functions? //block scoped function function f() { if (pred) { function g() {} } g( ); } //duplicate declarations function f() { if (pred) { function g() {} g( ); function g() {} } } Why not, ECMAScript 1-5 didn’t allow function declarations in blocks.
  • 33. But real browsers agree... //block scoped function? function f() { if (pred) { function g() {} g( ); } }
  • 34. and real browsers, disagree... function f() { g( ); //is g defined? if (pred) { function g() {} g( ); } } function f() { if (pred) { function g() {} g( ); //which g?? } function g() {} } Disagreement on non-standard features is an standardization opportunity.
  • 35. Unfortunately, all browsers agree: //block scoped function? function f() { if (pred) { function g() {} g( ); } g( ); //calls g from block } Web interoperability requires leaking some block level function declarations!
  • 36. What is the common interoperable browser semantics for block function declarations? • A function declared only once in a block can be called from within the block at any point following the actual declaration. • A function declared only once in a block, can be referenced from any point that follows the block in the surrounding function.
  • 37. Making block scoped functions compatible with intersection semantics function f() { var g; function __g(v) {g=v} if (pred) { function g() {} __g(g); } g( ); } function f() { if (pred) { function g() {} } g(); } As if But only if treating the function declaration as a hoisted var declaration would not be an error.
  • 39. • It’s real • It’s feature complete • It’s being implemented in your favorite bowers right now ECMAScript 6
  • 40. ECMAScript Resources The Official ECMAScript 5.1 Specification (HTML) http://www.ecma-international.org/ecma-262/5.1/ ES6 Specification Drafts http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts ES6 Feature Summary https://github.com/lukehoban/es6features ES6 translators and tools https://github.com/addyosmani/es6-tools TheTC-39 ECMAScript Design Discussion Mail List https://mail.mozilla.org/listinfo/es-discuss Test262:The Offical ECMAScript ImplementationTest Suite http://test262.ecmascript.org/ Please report bugs http://bugs.ecmascript.org

Notas do Editor

  1. All the PC’s + an “Internet of Things” Even light bulbs They expand our preception They expand out scope of actions
  2. No single vendor controls “JavaScript” What drives innovation? What actually gets implemented? Who makes language design decisions? Cumbersome standardization processes? Too slow rate of change? … or too fast?
  3. We’d like to go faster
  4. TC39 is really 10-20 individual contributors representing 6-8 organizations We don’t always agree. Representatives from the same organization don’t always agree. Apple, Mozilla, Google, Microsoft are major browser participants but not necessarily at the same level of engagement at any particular point in time. . TC-39 members participate in, listen to, and observe the web developer community. TC-39 reaches consensus on broad goals for future edition(s) Feature Champions prepare straw man proposals for wiki.ecmascript.org Discussed extensively on es-discuss and at F2F meetings Prototype implementations are encouraged, particularly in real browsers.
  5. TC39 really 10-20 individual contributors representing 6-8 organizations We don’t always agree. Representatives from the same organization don’t always agree. Apple, Mozilla, Google, Microsoft are major browser participants but not necessarily at the same level of engagement at any particular point in time. . For each proposal consensus is reach to either drop, accept, or iterate. Editor integrates a comprehensive specification into the “ES.next” draft. Ideally production implementations and test suites are developed prior to publication of “ES.next” standard Specifications for discrete functional subsystems or libraries may be issued as separate Ecma standards.
  6. http://www.flickr.com/photos/benledbetter-architect/sets/72157594338948430/
  7. http://www.robomargo.com/furniture.html