-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
280 lines (279 loc) · 12.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>JavaScript at 20</title>
<link rel="stylesheet" type="text/css" href="build/build.css">
</head>
<body>
<article>
<section>
<h1>JavaScript at 20</h1>
<h2><a href="https://twitter.com/BrendanEich">Brendan Eich</a></h2>
</section>
<section data-bespoke-backdrop="backdrop backdrop--html5_supes" class="html5_supes undefined">
<h2>Standardization</h2>
<h3>"Things that are impossible just take longer." <small>- Hixie</small></h3>
</section>
<section>
<h3>1995: Eich recruited to Netscape</h3>
<h2>"Come and put Scheme in the browser!"</h2>
</section>
<section>
<h3>2015: John Carmack put <a href="http://racket-lang.org/">Racket</a> in Oculus VR</h3>
</section>
<section><blockquote class="twitter-tweet" data-conversation="none" lang="en"><p lang="en" dir="ltr"><a href="https://twitter.com/auradeluxe">@auradeluxe</a> <b>1/ I did something once in ten days. Still paying, lol. If <a href="https://twitter.com/ID_AA_Carmack">@ID_AA_Carmack</a> gets Racket (née PLT Scheme) as metaverse JS, revenge</b></p>— BrendanEich (@BrendanEich) <a href="https://twitter.com/BrendanEich/status/616747428616646656">July 2, 2015</a></blockquote>
<hr><blockquote class="twitter-tweet" data-conversation="none" lang="en"><p lang="en" dir="ltr"><a href="https://twitter.com/auradeluxe">@auradeluxe</a> <a href="https://twitter.com/ID_AA_Carmack">@ID_AA_Carmack</a> <b>2/ sweet revenge on "make it [JS] look like Java" order givers at Netscape. I came to do "Scheme in the browser".</b></p>— BrendanEich (@BrendanEich) <a href="https://twitter.com/BrendanEich/status/616747886454312960">July 2, 2015</a></blockquote>
</section>
<section><blockquote class="twitter-tweet" lang="en"><p lang="en" dir="ltr"><a href="https://twitter.com/BrendanEich">@BrendanEich</a> <a href="https://twitter.com/ID_AA_Carmack">@ID_AA_Carmack</a> <a href="https://twitter.com/auradeluxe">@auradeluxe</a> <b>That order was the difference between a billion programmers and none :-).</b></p>— Marc Andreessen (@pmarca) <a href="https://twitter.com/pmarca/status/616755674387648512">July 2, 2015</a></blockquote></section>
<section>
<h3>What was it like to hack JS in 10 days?</h3>
</section>
<section><img src="images/bruce_campbell_army_of_darkness.jpg" height="430" width="375">
<h3>Painful.</h3>
</section>
<section><img src="images/beich1.gif" height="156" width="136">
<hr>
<ul>
<li>Morrissey?</li>
<li>Vince Vaughn?</li>
</ul>
</section>
<section><img src="images/swingers-vince.jpg" height="450" width="303"></section>
<section>
<h2>Java was the big Web VM</h2>
<h3>JavaScript was "little brother"</h3>
</section>
<section><img src="images/Java-Duke.jpg"></section>
<section>
<img style="position: relative; top: 0px; border: solid 1px lightgray;" class="transparent" src=images/applet-loading.png />
<img style="position: relative; top: -32px; left: -170px;" class="transparent" src=images/sbbod.gif />
</section>
<section>
<h3>Think back to 1995... what was on TV then?</h3>
</section>
<section><img src="images/1994-tv-shows.jpg" height="407" width="610"></section>
<section>
<h3>I had my big break that year...</h3>
</section>
<section><img src="images/friends_chandler_006.jpg" height="512" width="411"></section>
<section>
<h3>Even @pmarca roller-bladed then.</h3>
</section>
<section><img src="images/hackers_1995_rollerblading.jpg" height="300" width="504"></section>
<section>
<h3>I'd go to a real library to read Computer Science papers.</h3>
</section>
<section><img src="images/Margaret-Jacks-hall.jpg" height="512" width="439"></section>
<section>
<h3>John Doerr claims that even an idiot could have been a successful VC in the 1980s:</h3>
<h2>"All you had to do was hang around Margaret Jacks Hall."</h2>
</section>
<section>
<h3>Java's bytecode design influenced my work on JS.</h3>
</section>
<section><img src="images/Gosling-IR-paper.png" height="512" width="433"></section>
<section>
<h3>Java is <b>typed</b> (or statically typed) and has mostly-typed bytecode</h3>
<h3>JS is <b>untyped</b> (or dynamically typed)</h3>
</section>
<section><img src="images/Gosling-code-sample.png" height="400" width="742"></section>
<section>
<h3 class="bullet">So in <b>10 days</b> in May 1995, I wrote</h3>
<ul>
<li>A lexical scanner and parser for early JS</li>
<li>The parser emitted stack-machine bytecode</li>
<li>Which ran in a bytecode interpreter</li>
<li><code>Function.prototype.toString</code> bytecode decompiler</li>
<li>The standard library was poor</li>
<li><code>Array</code> was <code>Object</code> with <code>.length</code> property</li>
<li><code>Date</code> hand-ported <small>(h/t ksmith@netscape.com)</small> from <code>java.util.Date</code> </li>
</ul>
</section>
<section>
<h3>Mistakes were made (WTFJS, WAT)</h3>
</section>
<section>
<h3>But enough was good that JS survived</h3>
</section>
<section>
<h3><a href="http://web.archive.org/web/19970414102538/http://whitetailbutte.com/">http://whitetailbutte.com/</a> case study</h3>
<h3>Early DOM mattered as much as JS</h3>
</section>
<section>
<h2 class="bullet">Much progress since then</h2>
<ul>
<li><a href="http://asmjs.org/">asm.js</a> was discovered</li>
<li>ES6 is <a href="http://kangax.github.io/compat-table/es6/">all but done</a></li>
<li>typed arrays from WebGL are in ES6</li>
<li>typed objects coming in ES7</li>
<li><a href="http://www.typescriptlang.org/">TypeScript</a>, and now <a href="http://flowtype.org/">Flow</a></li>
</ul>
</section>
<section>
<pre><code class="language-javascript">class vector {
constructor(n) { this.arr = new Int32Array(n); }
sum() {
let la = this.arr;
let S = 0;
for (let i = la.length|0; (i=(i-1)|0) >= 0;)
S = (S + la[i|0])|0;
return S;
}
}
</code></pre>
</section>
<section><img src="images/java-vs-js-bytecode.png" height="384" width="512"></section>
<section>
<h3>JS is <b>untyped</b> (dynamically typed), <i>however:</i></h3>
<h3>asm.js is <b>typed</b> "bytecode" with deterministic performance</h3>
</section>
<section>
<h3>JS, a <b>dynamically typed</b> language, is often written with <b>latent static types</b></h3>
<h3><i>Especially when "written" by compilers</i></h3>
</section>
<section>
<h2 class="bullet">Compiling to JS is not new</h2>
<ul>
<li>Remember <a href="http://www.gwtproject.org/">GWT</a>, and <a href="http://www.openlaszlo.org/">OpenLaszlo</a> before it?</li>
<li><a href="http://coffeescript.org/">CoffeeScript</a>, now hundreds of compile-to-JS languages</li>
<li>(including <a href="http://dartlang.org/">Dart</a>)</li>
<li>See the <a href="https://shaunlebron.github.io/solar-system-of-js/">Solar System of JS</a></li>
<li>For C++ to JS, <a href="http://kripken.github.io/mloc_emscripten_talk/">Emscripten</a> by <a href="https://twitter.com/kripken">Alon Zakai</a></li>
</ul>
</section>
<section>
<h2>JS VMs compile to the metal</h2>
<h3>(just like Java but without declaring all types)</h3>
</section>
<section>
<h3>And the Java VM supports dynamic languages too:</h3>
</section>
<section><img src="images/java-7-as-dynlang-vm.jpg" height="480" width="640">
<p>from <a href="http://www.slideshare.net/nakov/java-7-new-features-by-mihail-stoynov-and-svetlin-nakov">Mikhail Stoynov and Svetlin Nakov</a></p>
</section>
<section>
<h2>The circle is now complete</h2><img src="images/obi-wan-and-vader.jpg" height="281" width="500">
</section>
<section>
<h2>WebAssembly</h2>
</section>
<section>
<ul>
<li><b>Consensus</b> from Apple/Google/Microsoft/Mozilla that the <a href="https://github.com/WebAssembly/design/">design</a> repo is approaching completeness</li>
<li>An <b>executable OCaml spec</b> and test suite in a new <a href="https://github.com/WebAssembly/spec/">spec</a> repo</li>
<li>Apple/Google/Mozilla are actively writing <b>prototype wasm support</b> in their engines' public repos</li>
<li>WebAssembly means <b>1VM</b> with 2 syntaxes, <b>.js and .wasm</b></li>
</ul>
</section>
<section>
<h2>What does WebAssembly look like?</h2>
<h3>It is hard to see binary</h3>
</section>
<section>
<pre><code class="language-javascript">enum class I32 : uint8_t {
LitPool, LitImm, GetLoc, GetGlo, SetLoc, SetGlo,
SLoad8, SLoadOff8, ULoad8, ULoadOff8,
SLoad16, SLoadOff16, ULoad16, ULoadOff16,
Load32, LoadOff32,
Store8, StoreOff8, Store16, StoreOff16, Store32, StoreOff32,
CallInt, CallInd, CallImp,
Cond, Comma,
FromF32, FromF64,
Neg, Add, Sub, Mul, SDiv, UDiv, SMod, UMod,
BitNot, BitOr, BitAnd, BitXor, Lsh, ArithRsh, LogicRsh,
Clz,
LogicNot,
EqI32, EqF32, EqF64, NEqI32, NEqF32, NEqF64,
SLeThI32, ULeThI32, LeThF32, LeThF64,
...
};
</code></pre>
</section>
<section>
<pre><code class="language-javascript">switch (i32) {
...
case I32::FromF32: ...(s, prec, ctx, Result::NoIsh, Ctx::Default, "~~"); break;
ak;
case I32::FromF64: ...(s, prec, ctx, Result::NoIsh, Ctx::Default, "~~"); break;
case I32::Neg: ...(s, prec, ctx, Result::Intish, Ctx::Default, "-"); break;
case I32::BitNot: ...(s, prec, ctx, Result::NoIsh, Ctx::ToI32, "~"); break;
...
}
</code></pre>
</section>
<section>
<h2>ES6 well-covered by other speakers</h2>
</section>
<section>
<h2>ES6/2015, ES7/2016, ES8...</h2>
<h3>Rapid(er) standards release process</h3>
</section>
<section>
<h2>ES7 async functions</h2>
</section>
<section>
<pre><code class="language-javascript">function chainAnimationsPromise(elem, animations) {
let ret = null;
let p = currentPromise;
for (let anim of animations) {
p = p.then(function(val) {
ret = val;
return anim(elem);
});
}
return p.catch(e => { /* ignore and keep going */ })
.then(() => { return ret; });
}
</code></pre>
</section>
<section>
<pre><code class="language-javascript">function chainAnimationsGenerator(elem, animations) {
return spawn(function*() {
let ret = null;
try {
for (let anim of animations) {
ret = yield anim(elem);
}
} catch(e) { /* ignore and keep going */ }
return ret;
});
}
</code></pre>
</section>
<section>
<pre><code class="language-javascript">async function chainAnimationsAsync(elem, animations) {
let ret = null;
try {
for (let anim of animations) {
ret = await anim(elem);
}
} catch(e) { /* ignore and keep going */ }
return ret;
}
</code></pre>
</section>
<section>
<h2 class="bullet">More on board for ES7+</h2>
<ul>
<li><a href="https://github.com/johnmccutchan/ecmascript_simd/">SIMD</a></li>
<li><a href="https://github.com/nikomatsakis/typed-objects-explainer/">typed objects </a></li>
<li><a href="https://github.com/nikomatsakis/typed-objects-explainer/blob/master/valuetypes.md">value objects</a>, including</li>
<li><code>int64</code> and <code>uint64</code></li>
<li>user-defined operators and literals</li>
<li>async generators</li>
</ul>
</section>
<section>
<h2>Hygienic macros: <a href="http://sweetjs.org/">Sweet.js</a></h2>
</section>
<section>
<h2>Demos</h2>
</section>
<section><img src="images/alwaysbetonjs.png" height="384" width="512"></section>
<section><img src="images/alwaysbetonjsandwasm.png" height="384" width="512"></section>
</article>
<script src="build/build.js"></script>
</body>
</html>