Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
The Future of JavaScript
Search
dherman
April 20, 2012
Programming
8.6k
52
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
The Future of JavaScript
SFRails, 4/19/12
dherman
April 20, 2012
More Decks by dherman
See All by dherman
Rust + Node = Neon
dherman
1
380
Evolving the World's Most Popular Programming Language
dherman
0
720
Closing iterators
dherman
0
830
A better future for comprehensions
dherman
0
2.1k
Evolution is Awesome
dherman
0
670
Status Report: ES6 Modules
dherman
16
4.1k
Discussion with TC39 about the semantics of symbols
dherman
1
450
September 2013 Modules Status Update
dherman
2
1.3k
Rust: low-level programming without the segfaults
dherman
13
9.1k
Other Decks in Programming
See All in Programming
These Five Tricks Can Make Your Apps Greener, Cheaper, & Nicer
hollycummins
0
280
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
160
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.2k
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
190
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
110
AIで効率化できた業務・日常
ochtum
0
130
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
510
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
320
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
130
Oxlintのカスタムルールの現況
syumai
6
1.1k
OSもどきOS
arkw
0
550
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
3
1.3k
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1.1k
How GitHub (no longer) Works
holman
316
150k
Crafting Experiences
bethany
1
180
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
250
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
570
Technical Leadership for Architectural Decision Making
baasie
3
400
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
140
WENDY [Excerpt]
tessaabrams
11
38k
Transcript
THE FUTURE => OF JAVASCRIPT Dave Herman
Hi, I’m dherman @littlecalculist
I — JavaScript and I love the language it almost
is...
None
None
modules • block scoping • generators • proxies • binary
data • destructuring • rest-args & defaults • name objects • custom iteration • comprehensions • string templates • hash tables & weak maps • class syntax • full Unicode • function/object shorthands tl;dr:
Great libraries need modules
var Collections = (function() { function Dict()
{ ... } return { Dict: Dict }; })();
None
browser <script></script>
“The human compiler, at work.” — Paul Graham “The sincerest
form of feature request.” — someone?
module Collections { export function Dict() {
... } }
import { $ } from "jquery.js"; import { map, each
} from "underscore.js";
import { $ } from "jquery.js"; import { map, each
} from "underscore.js"; loaded once, before execution
Generators cleaning up callback spaghetti
XHR("foo.txt", function(foo) { XHR("bar.txt", function(bar) {
XHR("baz.txt", function(baz) { setTimeout(function() { status.innerHTML = foo + bar + baz; }, 1000); }); }); });
XHR("foo.txt", function(foo) { XHR("bar.txt", function(bar) {
XHR("baz.txt", function(baz) { setTimeout(function() { status.innerHTML = foo + bar + baz; }, 1000); }); }); }); pyramid of doom
function onTimeout(foo, bar, baz) { status.innerHTML =
foo + bar + baz; } XHR("foo.txt", function(foo) { XHR("bar.txt", function(bar) { XHR("baz.txt", function(baz) { setTimeout(function() { onTimeout(foo, bar, baz); }, 1000); }); }); });
function onTimeout(foo, bar, baz) { status.innerHTML =
foo + bar + baz; } function onBaz(foo, bar, baz) { setTimeout(function() { onTimeout(foo, bar, baz); }, 1000); } XHR("foo.txt", function(foo) { XHR("bar.txt", function(bar) { XHR("baz.txt", function(baz) { onBaz(foo, bar, baz); }); }); });
function onTimeout(foo, bar, baz) { status.innerHTML =
foo + bar + baz; } function onBaz(foo, bar, baz) { setTimeout(function() { onTimeout(foo, bar, baz); }, 1000); } function onBar(foo, bar) { XHR("baz.txt", function(baz) { onBaz(foo, bar, baz); }); } XHR("foo.txt", function(foo) { XHR("bar.txt", function(bar) { onBar(foo, bar); }); });
function onTimeout(foo, bar, baz) { status.innerHTML =
foo + bar + baz; } function onBaz(foo, bar, baz) { setTimeout(function() { onTimeout(foo, bar, baz); }, 1000); } function onBar(foo, bar) { XHR("baz.txt", function(baz) { onBaz(foo, bar, baz); }); } function onFoo(foo) { XHR("bar.txt", function(bar) { onBar(foo, bar); }); } XHR("foo.txt", onFoo);
Pour 1/2 cup water into pan. When you’re done: Bring
water to boil. When that’s done: Lower heat and add rice. After 15 minutes: Turn off heat and serve.
spawn(function*() { var foo = yield read("foo.txt"),
bar = yield read("bar.txt"), baz = yield read("baz.txt"); yield sleep(1000); status.innerHTML = foo + bar + baz; }); promise
Binary data efficient memory layout and I/O
var Point2D = struct({ x: uint32,
y: uint32 }); var Color = struct({ r: uint8, g: uint8, b: uint8 });
var Pixel = struct({ point: Point2D,
color: Color }); var Triangle = array(Pixel, 3);
new Triangle([ { point: { x: 0,
y: 0 }, color: { r: 255, g: 255, b: 255 } }, { point: { x: 5, y: 5 }, color: { r: 128, g: 0, b: 0 } }, { point: { x: 10, y: 0 }, color: { r: 0, g: 0, b: 128 } } ])
Name objects first-class, unique property keys
function Container() { var secret = 3;
this.service = function() { if (secret-‐-‐) { ... } }; }
var key = new Name("secret"); function Container() { this[key] =
3 } Container.prototype = { service: function() { if (this[key]-‐-‐) { ... } } };
Familiar friends… should be no surprise for Rubyists
Destructuring: var [x, y] = getPair(); Parameter defaults: function(x=0, y=0)
{ } Rest/splat: function(...args) { return args } Iterators: for (x of keys(obj)) { } String interpolation: `Hello ${username}!`
The bigger picture…
“Be a better language for: a. complex apps b. libraries
c. code generators”
Motivated by use cases. Solve with simple, general, composable features.
Pieces have to fit together in a cohesive whole.
study the issues study the big picture study the issues
again study the big picture again study the issues again SHIP IT!
Work in the open wiki.ecmascript.org
[email protected]
Work in the open wiki.ecmascript.org
[email protected]
Thank you.