❤WebAssembly and the Future Of Javascript

Seth Samuel (NY ↝ PDX ↝ Elsewhere ↝ PDX ↝ NYC)

sethsamuel

Follow along:

sethsamuel.github.io

Disclaimer(s)

What is WebAssembly?

A Brief History of the Web

1822

Charles Babbage

1842

Ada Lovelace

1945

Alan Turing

1952

Grace Hopper

1989

Tim Berners-Lee

1995

Brendan Eich

2009

Ryan Dahl

Now

You

Assembly

Programming languages are a bridge between human thought
and machine processing.

Why do we need abstractions?

Electrons

Machine code

1100101010101101010

Assembly

mov eax, 45
mov ebx, 55
add eax, ebx
push eax

Grace Hopper

Low(er) level languages

int *ptr_one;
ptr_one = (int *)malloc(sizeof(int));
free(ptr_one);

High(er) level languages

var s = 1;
s = ["Hello"];
s[2] = "Empire";
s["a"] = "Node";

Visual languages

Higher level ↝ less efficient *

asm.js

function Module() {
  "use asm";
  function add(x, y) {
    x = x | 0;
    y = y | 0;
    return x + y;
  }
  return { add: add };
}

WebAssembly Abract Syntax Tree (WAST)

WAST is a shared target for compilers

Learn more

Mariko Kosaka - How to be* a compiler 

Browsers (and node) can efficiently transform WAST into Assembly

WAST

(module
  (memory 256 256)
  (export "memory" memory)
  (export "add" $add)
  (func $add (param $0 i32) (param $1 i32) (result i32)
    (i32.add
      (get_local $0)
      (get_local $1)
    )
  )
)

Demo

Benefits

Less npm postinstall building

Compiled system langauges in the browser

Pick the right tool for the job

Learn more/Do more

https://github.com/WebAssembly/design

Thanks!

sethsamuel