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
840
A better future for comprehensions
dherman
0
2.1k
Evolution is Awesome
dherman
0
680
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.4k
Rust: low-level programming without the segfaults
dherman
13
9.1k
Other Decks in Programming
See All in Programming
初めてのKubernetes 本番運用でハマった話
oku053
0
120
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
160
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
380
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.2k
フィードバックで育てるAI開発
kotaminato
1
110
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
260
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
150
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
100
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
140
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
340
ビデオ通話が繋がる0.2秒で何が起きているのか
supurazako
2
130
アルゴリズムは何を圧縮しているのか ─ Haskell から育った「圧縮代数」というメンタルモデル
naoya
16
3.3k
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
55
8.2k
How GitHub (no longer) Works
holman
316
150k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
800
WENDY [Excerpt]
tessaabrams
11
38k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
340
We Are The Robots
honzajavorek
0
280
Mind Mapping
helmedeiros
PRO
1
280
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
290
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
460
Believing is Seeing
oripsolob
1
170
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
300
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.