SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
Web Platform: Present and
Future
Brendan Eich
<brendan@mozilla.org>

Friday, November 29, 13
Agenda
•
•
•
•
•

Friday, November 29, 13

Extensible Web Manifesto
JavaScript Deep Dive
Emscripten and asm.js
HTML/CSS/DOM/WebGL
Dev/Sys/Web APIs

•
•
•
•
•

WebRTC
Networking
Privacy, Trust, User Agency
Servo
Conclusion
Extensible Web Manifesto
•
•
•
•
•
Friday, November 29, 13

http://extensiblewebmanifesto.org/
Focus on new, safe, low-level capabilities for the web platform
Expose capabilities that explain existing features, e.g., HTML
Develop and test new high-level standard libraries on github
Prioritize efforts that follow these recommendations over
other work
JavaScript
•
•
•

AKA ECMAScript, ECMA-262, ES
ES Harmony = editions from 5 on
Harmony goals

•
•
•
Friday, November 29, 13

better for applications
better for libraries
better for code generators
Harmony - ES5
•
•
•
•
•
•
•
•
•
•
•

Friday, November 29, 13

“use	
  strict”;	
  //	
  strict	
  mode	
  pseudo-­‐pragma
Object.create(proto,	
  props)
Object.defineProperty(obj,	
  name,	
  desc)
Object.defineProperties(obj,	
  descs)
Object.getPrototypeOf(obj)
Object.keys(obj)
Object.seal(obj)
Object.freeze(obj)
Object.preventExtensions(obj)
Object.isSealed(obj)
Object.isFrozen(obj)

•
•
•
•
•
•
•
•
•
•
•

Object.isExtensible(obj)
Object.getOwnPropertyDescriptor(obj,	
  name)
Object.getOwnPropertyNames(obj)
Date.prototype.toISOString()
Date.now()
Array.isArray(value)
JSON
Function.prototype.bind(self,	
  ...args)
String.prototype.trim()
Array.prototype.indexOf(value[,	
  from])
Array.prototype.lastIndexOf(value[,	
  from])
Harmony - ES5, cont
•
•
•
•
•
•
•
•
•
•
•

Friday, November 29, 13

Array.prototype.every(callback[,	
  self])
Array.prototype.some(callback[,	
  self])
Array.prototype.forEach(callback[,	
  self])
Array.prototype.map(callback[,	
  self])
Array.prototype.filter(callback[,	
  self])
Array.prototype.reduce(callback[,	
  accum])

•

Strict	
  errors:

•
•
•
•
•

Array.prototype.reduceRight(call[,	
  accum])
var	
  obj	
  =	
  {get	
  x()	
  {return	
  this._x;}	
  ...};
var	
  obj	
  =	
  {set	
  x(nx)	
  {this._x	
  =	
  nx;}	
  ...};
var	
  s	
  =	
  “asdf”;	
  assertEqual(s[3],	
  ‘f’);
var	
  keywords	
  =	
  {delete:1,	
  if:2,	
  while:3};

f.caller,	
  f.arguments	
  for	
  function	
  f
var	
  o	
  =	
  {dup:	
  1,	
  dup:	
  2};
with	
  (o);	
  //	
  any	
  with	
  statement
function	
  f(dup,	
  dup)	
  {...}
let	
  implements	
  interface	
  private	
  public
package	
  protected	
  static	
  yield

•
•
•
•

octal	
  numeric	
  literals	
  &	
  string	
  escapes
can’t	
  create	
  global	
  var	
  by	
  assignment
eval,	
  arguments,	
  delete	
  restrictions
this	
  is	
  not	
  coerced	
  to	
  object
Harmony - ES5 Compat

Friday, November 29, 13
ES5 Resources
•
•
•

Friday, November 29, 13

http://ecma-international.org/ecma-262/5.1/

http://kangax.github.io/es5-compat-table/

http://www.ecma-international.org/publications/standards/
Ecma-262-arch.htm
Harmony - ES6
•
•
•
•

•
•
•

Friday, November 29, 13

var	
  obj	
  =	
  {[“key_”	
  +	
  nextId()]:	
  value};
var	
  obj	
  =	
  {method()	
  {	
  return	
  42;	
  }};
var	
  square	
  =	
  x	
  =>	
  x	
  *	
  x;
class	
  Point	
  {
	
  	
  constructor(x,	
  y)	
  {
	
  	
  	
  	
  this.x	
  =	
  x,	
  this.y	
  =	
  y;
	
  	
  }
	
  	
  add(p)	
  {
	
  	
  	
  	
  this.x	
  +=	
  p.x,	
  this.y	
  +=	
  p.y;
	
  	
  }
}
class	
  MyNodeList	
  extends	
  NodeList	
  {...}
let	
  x	
  =	
  “outer”;	
  {let	
  x	
  =	
  “inner”;	
  ...}
const	
  TAU	
  =	
  2	
  *	
  Math.PI;

•
•
•
•
•
•
•
•
•
•
•

function	
  f(a	
  =	
  1,	
  b	
  =	
  2	
  *	
  a)	
  {...}
let	
  rotateArray	
  =	
  (h,	
  ...t)	
  =>	
  t.push(h);
let	
  a	
  =	
  [1,	
  2,	
  3];	
  rotateArray(0,	
  ...a);
let	
  b	
  =	
  [0,	
  ...a,	
  4,	
  5,	
  6];
export	
  function	
  transcode(src,	
  url)	
  {...}
import	
  {keys,	
  entries}	
  from	
  “@iter”;
for	
  (let	
  [k,v]	
  of	
  entries(o))	
  print(k,v);
let	
  eager	
  =	
  [for	
  (v	
  of	
  values(o))	
  2	
  *	
  v];
let	
  lazy	
  	
  =	
  (for	
  (v	
  of	
  values(o))	
  2	
  *	
  v);
function	
  iter()	
  {	
  return	
  {next()	
  {...};	
  }
function*	
  gen()	
  {	
  yield	
  1;	
  yield	
  2;	
  }
Harmony - ES6, cont
•
•
•

•

Friday, November 29, 13

console.log(`interpolate	
  ${x}`);
let	
  lexer	
  =	
  /w+|d+/y;	
  //	
  y	
  for	
  stickY
map	
  =	
  Map([[‘key’,	
  42],	
  [obj,	
  “foo”]]);
map.get(‘key’)	
  //	
  42
map.get(obj)	
  	
  	
  //	
  “foo”
map.set(obj,	
  “bar”)
map.get(obj)	
  //	
  “bar”
map.size	
  	
  	
  	
  	
  //	
  2
for	
  (let	
  [k,	
  v]	
  of	
  map)	
  print(k,	
  v)
map.delete(‘key’);	
  map.size	
  //	
  1
set	
  =	
  Set([0,	
  1,	
  2,	
  3]);
set.has(0)	
  //	
  true
set.add(9)
set.size	
  //	
  5
for	
  (let	
  elt	
  of	
  set)	
  print(elt)
set.delete(9);	
  set.size	
  //	
  4

•
•
•

let	
  objectCache	
  =	
  WeakMap();	
  //	
  advanced

•
•
•
•
•
•
•

const	
  Triangle	
  =	
  new	
  ArrayType(Point,	
  3);

var	
  proxy	
  =	
  new	
  Proxy(target,	
  handler);
const	
  Point	
  =
	
  	
  new	
  StructType({x:	
  uint32,	
  y:	
  uint32});

{	
  function	
  in_block()	
  {	
  return	
  42;	
  }	
  ...	
  }
let	
  {x,	
  y}	
  =	
  aPoint;
let	
  [v1,	
  v2,	
  v3]	
  =	
  aTriangle;
Object.assign(target,	
  source);
Object.mixin(target,	
  source);
Symbols,	
  many	
  new	
  methods,	
  more...
Harmony - ES6 Compat

Friday, November 29, 13
ES6 Resources
•
•
•
•
Friday, November 29, 13

https://github.com/google/traceur-compiler

http://kangax.github.io/es5-compat-table/es6/

http://people.mozilla.org/~jorendorff/es6-draft.html
http://wiki.ecmascript.org/doku.php?
id=harmony:specification_drafts
Harmony - ES7
•

Object.observe(target,	
  observer)
//	
  http://wiki.ecmascript.org/doku.php?id=harmony:observe

•

SIMD	
  intrinsics,	
  e.g.	
  SIMD.add(a,	
  b)
//	
  https://github.com/johnmccutchan/ecmascript_simd

•

Friday, November 29, 13

Value	
  objects	
  -­‐	
  deep	
  dive	
  ahead
Value Objects

• int64, uint64
• int32x4, int32x8 (SIMD)
• float32 (to/from Float32Array today)
• float32x4, float32x8 (SIMD)
• bignum
• decimal
• rational
• complex
Friday, November 29, 13
Overloadable Operators

•| ^ &
•==
•< <=
•<< >> >>>
•+ •* / %
•~ boolean-test
Friday, November 29, 13

unary- unary+
Preserving Boolean Algebra

• != and ! are not overloadable, to preserve identities including
• X ? A : B <=> !X ? B : A
• !(X && Y) <=> !X || !Y
• !(X || Y) <=> !X && !Y
<=> !(X == Y)
• X != Y

Friday, November 29, 13
Preserving Relational Relations

• > and >= are derived from < and <= as follows:
• A > B <=> B < A
• A >= B <=> B <= A

• We provide <= in addition to < rather than derive A

<= B

from !(B < A) in order to allow the <= overloading to match
the same value object’s == semantics -- and for special cases,
e.g., unordered values (NaNs)

Friday, November 29, 13
Strict Equality Operators

• The strict equality operators, === and !==, cannot be overloaded
• They work on frozen-by-definition value objects via a structural
recursive strict equality test (beware, NaN !== NaN)

• Same-object-reference remains a fast-path optimization

Friday, November 29, 13
Why Not Double Dispatch?

• Left-first asymmetry (v value, n number):
•v
•n

+ n

==>

v.add(n)

+ v

==>

v.radd(n)

• Anti-modular: exhaustive other-operand type enumeration
required in operator method bodies

• Consequent loss of compositionality: complex and rational
cannot be composed to make ratplex without modifying
source or wrapping in proxies

Friday, November 29, 13
Cacheable Multimethods

• Proposed in 2009 by Christian Plesner Hansen (Google) in esdiscuss

• Avoids double-dispatch drawbacks from last slide: binary operators
implemented by 2-ary functions for each pair of types

• Supports Polymorphic Inline Cache (PIC) optimizations (Christian
was on the V8 team)

• Background reading: [Chambers 1992]
Friday, November 29, 13
Binary Operator Example

• For the expression v + u
• Let p = v.[[Get]](@@ADD)
• If p is not a Set, throw a TypeError
• Let q = u.[[Get]](@@ADD_R)
• If q is not a Set, throw a TypeError
• Let r = p intersect q
• If r.size != 1 throw a TypeError
• Let f = r[0]; if f is not a function, throw
• Evaluate f(v, u) and return the result
Friday, November 29, 13
API Idea from CPH 2009
function addPointAndNumber(a, b) {
return Point(a.x + b, a.y + b);
}
Function.defineOperator('+', addPointAndNumber, Point, Number);
function addNumberAndPoint(a, b) {
return Point(a + b.x, a + b.y);
}
Function.defineOperator('+', addNumberAndPoint, Number, Point);
function addPoints(a, b) {
return Point(a.x + b.x, a.y + b.y);
}
Function.defineOperator('+', addPoints, Point, Point);

Friday, November 29, 13
Literal Syntax

• int64(0)
• uint64(0)
• float32(0)
• bignum(0)
• decimal(0)

==>

0L // as in C#

==> 0UL // as in C#
==>

0f // as in C#

==>

0n // avoid i/I

==>

0m // or M, C/F#

• We want a syntax extension mechanism, but declarative not
runtime API

• This means new syntax for operator and suffix definition
Friday, November 29, 13
Straw Value Object Declaration Syntax
value class point2d { // implies typeof “point2d”
constructor point2d(x, y) {
this.x = +x;
this.y = +y;
// implicit Object.freeze(this) on return
}
point2d + number (a, b) {
return point2d(a.x + b, a.y + b);
}
number + point2d (a, b) {
return point2d(a + b.x, a + b.y);
}
point2d + point2d (a, b) {
return point2d(a.x + b.x, a.y + b.y);
}
// more operators, suffix declaration handler, etc.
}

Friday, November 29, 13
SIMD

Single Instruction, Multiple Data (SSE, NEON, etc.)

Friday, November 29, 13
SIMD intrinsics
•
•
•
•

Friday, November 29, 13

Game, DSP, other low-level hackers need them
John McCutchan added them to DartVM
Dart-to-the-heart? No, Dart2JS needs ‘em in JS
A Google, Intel, Mozilla, Ecma TC39 joint
Possible ES7 Polyfillable SIMD API

https://github.com/johnmccutchan/ecmascript_simd

var a = float32x4(1.0, 2.0, 3.0, 4.0);
var b = float32x4(5.0, 6.0, 7.0, 8.0);
var c = SIMD.add(a, b);
// Also SIMD.{sub,mul,div,neg,abs} etc.
// See ES7 Value Objects for some sweet
// operator overloading sugar.

Friday, November 29, 13
Why Operator Syntax Matters
From Cameron Purdy’s blog:

“At a client gig, they were doing business/financial coding, so were using BigDecimal.
Of course, .add() and friends is too difficult, so they ended up with roughly:
BigDecimal subA = ...
BigDecimal subB = ...
BigDecimal total = new BigDecimal(
subA.doubleValue() + subB.doubleValue() );
It was beautiful.”
Posted by Bob McWhirter on October 31, 2005 at 08:17 AM EST

Friday, November 29, 13
Emscripten & asm.js
HTML/CSS/DOM/WebGL
[continue]

Friday, November 29, 13
Sys/Dev/Web APIs
[continue]

Friday, November 29, 13
WebRTC
•
•
•
•
•

Friday, November 29, 13

Video/audio/data p2p & n-way realtime browser-based communication

Peer-to-peer file sharing: https://www.sharefest.me/

A simple two-party videocall: https://apprtc.webrtc.org/
Multiparty conferences (up to 4 people): http://tokbox.com/opentok/
quick-start/demo.html

Real-time multiplayer gaming: https://developer.mozilla.org/en-US/demos/
detail/bananabread/launch
Friday, November 29, 13
Friday, November 29, 13
WebRTC Sample JS
•
•
•

var	
  pc	
  =	
  new	
  RTCPeerConnection();
var	
  localVideo	
  =	
  document.getElementById(“local”);
navigator.getUserMedia(
	
  	
  {video:	
  true,	
  audio:	
  true},
	
  	
  function	
  (stream)	
  {
	
  	
  	
  	
  pc.addStream(stream);
	
  	
  	
  	
  //	
  See	
  https://github.com/HenrikJoreteg/attachMediaStream
	
  	
  	
  	
  attachMediaStream(localVideo,	
  stream);
	
  	
  },
	
  	
  function	
  ()	
  {	
  console.log(“failed	
  to	
  get	
  video	
  camera”)	
  }
);

Friday, November 29, 13
WebRTC in Detail
[continue]

Friday, November 29, 13
WebRTC Resources
•
•
•
•
Friday, November 29, 13

https://speakerdeck.com/henrikjoreteg/webrtc-jsconfbrazil-2013
https://github.com/HenrikJoreteg/jsconfbr
http://iswebrtcreadyyet.com/
https://talky.io/
Networking
•
•
•
•
•
•
Friday, November 29, 13

Layering hurts (Sam Ruby, OSCON 2005? I forget)
DNS lookup, HTML load, img and script step on each other
and power up the radio just as it is powering down
10kbs on LTE, not great
Here, underused on server side: SPDY; coming: HTTP2
We can fix things incrementally with better coordination
Privacy, Trust, User Agency
•
•

•
Friday, November 29, 13

Mozilla won “Most Trusted for Privacy” award in 2012
Working to earn it:

•
•
•
•

Sync encrypts client-side, but key mgmt beyond most users
Verified builds on Linux, using bootstrapped/verified clang
Use as a trust anchor to verify Mozilla services
Yes, Mozilla is doing services: https://services.mozilla.com/

What would a user-first Web of services look like?
Servo

•

Friday, November 29, 13

A brief demo showing of Mozilla’s new parallel/safe engine...
Conclusion
•
•
•
•
•
•
Friday, November 29, 13

First they said that JS or the Web stack
couldn’t do “Rich Internet Applications”
Then they said it couldn’t be fast enough
Then they said it couldn’t be fixed
Wrong every time!
Always bet on {JS, HTML, WebGL, ...}
Really, always bet on Web Developers

Weitere ähnliche Inhalte

Was ist angesagt?

Functional and Algebraic Domain Modeling
Functional and Algebraic Domain ModelingFunctional and Algebraic Domain Modeling
Functional and Algebraic Domain ModelingDebasish Ghosh
 
First-Class Patterns
First-Class PatternsFirst-Class Patterns
First-Class PatternsJohn De Goes
 
Deriving Scalaz
Deriving ScalazDeriving Scalaz
Deriving Scalaznkpart
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scalaRuslan Shevchenko
 
Algebraic Thinking for Evolution of Pure Functional Domain Models
Algebraic Thinking for Evolution of Pure Functional Domain ModelsAlgebraic Thinking for Evolution of Pure Functional Domain Models
Algebraic Thinking for Evolution of Pure Functional Domain ModelsDebasish Ghosh
 
Railroading into Scala
Railroading into ScalaRailroading into Scala
Railroading into ScalaNehal Shah
 
Refinement Types for Haskell
Refinement Types for HaskellRefinement Types for Haskell
Refinement Types for HaskellMartin Ockajak
 
Comparing Haskell & Scala
Comparing Haskell & ScalaComparing Haskell & Scala
Comparing Haskell & ScalaMartin Ockajak
 
Scala for Java Developers
Scala for Java DevelopersScala for Java Developers
Scala for Java DevelopersMartin Ockajak
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and DestructorsKeyur Vadodariya
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional ProgrammingYuan Wang
 
Power of functions in a typed world
Power of functions in a typed worldPower of functions in a typed world
Power of functions in a typed worldDebasish Ghosh
 
Programming Languages: some news for the last N years
Programming Languages: some news for the last N yearsProgramming Languages: some news for the last N years
Programming Languages: some news for the last N yearsRuslan Shevchenko
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1Troy Miles
 

Was ist angesagt? (20)

Functional and Algebraic Domain Modeling
Functional and Algebraic Domain ModelingFunctional and Algebraic Domain Modeling
Functional and Algebraic Domain Modeling
 
First-Class Patterns
First-Class PatternsFirst-Class Patterns
First-Class Patterns
 
Deriving Scalaz
Deriving ScalazDeriving Scalaz
Deriving Scalaz
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scala
 
Algebraic Thinking for Evolution of Pure Functional Domain Models
Algebraic Thinking for Evolution of Pure Functional Domain ModelsAlgebraic Thinking for Evolution of Pure Functional Domain Models
Algebraic Thinking for Evolution of Pure Functional Domain Models
 
Railroading into Scala
Railroading into ScalaRailroading into Scala
Railroading into Scala
 
Towards hasktorch 1.0
Towards hasktorch 1.0Towards hasktorch 1.0
Towards hasktorch 1.0
 
Refinement Types for Haskell
Refinement Types for HaskellRefinement Types for Haskell
Refinement Types for Haskell
 
Comparing Haskell & Scala
Comparing Haskell & ScalaComparing Haskell & Scala
Comparing Haskell & Scala
 
Scala for Java Developers
Scala for Java DevelopersScala for Java Developers
Scala for Java Developers
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
Scalaz
ScalazScalaz
Scalaz
 
Overview of c (2)
Overview of c (2)Overview of c (2)
Overview of c (2)
 
Maps&hash tables
Maps&hash tablesMaps&hash tables
Maps&hash tables
 
R programmingmilano
R programmingmilanoR programmingmilano
R programmingmilano
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
 
Power of functions in a typed world
Power of functions in a typed worldPower of functions in a typed world
Power of functions in a typed world
 
Programming Languages: some news for the last N years
Programming Languages: some news for the last N yearsProgramming Languages: some news for the last N years
Programming Languages: some news for the last N years
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
 
Aspdot
AspdotAspdot
Aspdot
 

Andere mochten auch

Andere mochten auch (13)

Fluent15
Fluent15Fluent15
Fluent15
 
My dotJS Talk
My dotJS TalkMy dotJS Talk
My dotJS Talk
 
Taysom seminar
Taysom seminarTaysom seminar
Taysom seminar
 
Mozilla's NodeConf talk
Mozilla's NodeConf talkMozilla's NodeConf talk
Mozilla's NodeConf talk
 
Capitol js
Capitol jsCapitol js
Capitol js
 
Paren free
Paren freeParen free
Paren free
 
JSLOL
JSLOLJSLOL
JSLOL
 
Mozilla Research Party Talk
Mozilla Research Party TalkMozilla Research Party Talk
Mozilla Research Party Talk
 
dotJS 2015
dotJS 2015dotJS 2015
dotJS 2015
 
Always bet on JS - Finjs.io NYC 2016
Always bet on JS - Finjs.io NYC 2016Always bet on JS - Finjs.io NYC 2016
Always bet on JS - Finjs.io NYC 2016
 
Splash
SplashSplash
Splash
 
Txjs talk
Txjs talkTxjs talk
Txjs talk
 
The Same-Origin Saga
The Same-Origin SagaThe Same-Origin Saga
The Same-Origin Saga
 

Ähnlich wie Web futures

Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...Tim Chaplin
 
The Present and Future of the Web Platform
The Present and Future of the Web PlatformThe Present and Future of the Web Platform
The Present and Future of the Web PlatformC4Media
 
JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)Eduard Tomàs
 
JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016Codemotion
 
Front end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript coreFront end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript coreWeb Zhao
 
Learn JavaScript by modeling Rubik Cube
Learn JavaScript by modeling Rubik CubeLearn JavaScript by modeling Rubik Cube
Learn JavaScript by modeling Rubik CubeManoj Kumar
 
ITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function ProgrammingITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function ProgrammingIstanbul Tech Talks
 
app4.pptx
app4.pptxapp4.pptx
app4.pptxsg4795
 
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Víctor Bolinches
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxDavid Rodenas
 
2 m2.w2.d1 - oop
2   m2.w2.d1 - oop2   m2.w2.d1 - oop
2 m2.w2.d1 - oopJustin Chen
 
Swift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CSwift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CAlexis Gallagher
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoMatt Stine
 
Scalable JavaScript
Scalable JavaScriptScalable JavaScript
Scalable JavaScriptYnon Perek
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonAlex Payne
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almostQuinton Sheppard
 
Explaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeExplaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeCory Forsyth
 
Monads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy DyagilevMonads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy DyagilevJavaDayUA
 
using python module: doctest
using python module: doctestusing python module: doctest
using python module: doctestmitnk
 

Ähnlich wie Web futures (20)

Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
 
The Present and Future of the Web Platform
The Present and Future of the Web PlatformThe Present and Future of the Web Platform
The Present and Future of the Web Platform
 
JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)
 
JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016
 
Front end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript coreFront end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript core
 
Learn JavaScript by modeling Rubik Cube
Learn JavaScript by modeling Rubik CubeLearn JavaScript by modeling Rubik Cube
Learn JavaScript by modeling Rubik Cube
 
ITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function ProgrammingITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function Programming
 
app4.pptx
app4.pptxapp4.pptx
app4.pptx
 
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicox
 
2 m2.w2.d1 - oop
2   m2.w2.d1 - oop2   m2.w2.d1 - oop
2 m2.w2.d1 - oop
 
Swift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CSwift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-C
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to Go
 
Scalable JavaScript
Scalable JavaScriptScalable JavaScript
Scalable JavaScript
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the Horizon
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
 
Explaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeExplaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to Come
 
Monads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy DyagilevMonads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy Dyagilev
 
using python module: doctest
using python module: doctestusing python module: doctest
using python module: doctest
 

Kürzlich hochgeladen

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Kürzlich hochgeladen (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

Web futures

  • 1. Web Platform: Present and Future Brendan Eich <brendan@mozilla.org> Friday, November 29, 13
  • 2. Agenda • • • • • Friday, November 29, 13 Extensible Web Manifesto JavaScript Deep Dive Emscripten and asm.js HTML/CSS/DOM/WebGL Dev/Sys/Web APIs • • • • • WebRTC Networking Privacy, Trust, User Agency Servo Conclusion
  • 3. Extensible Web Manifesto • • • • • Friday, November 29, 13 http://extensiblewebmanifesto.org/ Focus on new, safe, low-level capabilities for the web platform Expose capabilities that explain existing features, e.g., HTML Develop and test new high-level standard libraries on github Prioritize efforts that follow these recommendations over other work
  • 4. JavaScript • • • AKA ECMAScript, ECMA-262, ES ES Harmony = editions from 5 on Harmony goals • • • Friday, November 29, 13 better for applications better for libraries better for code generators
  • 5. Harmony - ES5 • • • • • • • • • • • Friday, November 29, 13 “use  strict”;  //  strict  mode  pseudo-­‐pragma Object.create(proto,  props) Object.defineProperty(obj,  name,  desc) Object.defineProperties(obj,  descs) Object.getPrototypeOf(obj) Object.keys(obj) Object.seal(obj) Object.freeze(obj) Object.preventExtensions(obj) Object.isSealed(obj) Object.isFrozen(obj) • • • • • • • • • • • Object.isExtensible(obj) Object.getOwnPropertyDescriptor(obj,  name) Object.getOwnPropertyNames(obj) Date.prototype.toISOString() Date.now() Array.isArray(value) JSON Function.prototype.bind(self,  ...args) String.prototype.trim() Array.prototype.indexOf(value[,  from]) Array.prototype.lastIndexOf(value[,  from])
  • 6. Harmony - ES5, cont • • • • • • • • • • • Friday, November 29, 13 Array.prototype.every(callback[,  self]) Array.prototype.some(callback[,  self]) Array.prototype.forEach(callback[,  self]) Array.prototype.map(callback[,  self]) Array.prototype.filter(callback[,  self]) Array.prototype.reduce(callback[,  accum]) • Strict  errors: • • • • • Array.prototype.reduceRight(call[,  accum]) var  obj  =  {get  x()  {return  this._x;}  ...}; var  obj  =  {set  x(nx)  {this._x  =  nx;}  ...}; var  s  =  “asdf”;  assertEqual(s[3],  ‘f’); var  keywords  =  {delete:1,  if:2,  while:3}; f.caller,  f.arguments  for  function  f var  o  =  {dup:  1,  dup:  2}; with  (o);  //  any  with  statement function  f(dup,  dup)  {...} let  implements  interface  private  public package  protected  static  yield • • • • octal  numeric  literals  &  string  escapes can’t  create  global  var  by  assignment eval,  arguments,  delete  restrictions this  is  not  coerced  to  object
  • 7. Harmony - ES5 Compat Friday, November 29, 13
  • 8. ES5 Resources • • • Friday, November 29, 13 http://ecma-international.org/ecma-262/5.1/ http://kangax.github.io/es5-compat-table/ http://www.ecma-international.org/publications/standards/ Ecma-262-arch.htm
  • 9. Harmony - ES6 • • • • • • • Friday, November 29, 13 var  obj  =  {[“key_”  +  nextId()]:  value}; var  obj  =  {method()  {  return  42;  }}; var  square  =  x  =>  x  *  x; class  Point  {    constructor(x,  y)  {        this.x  =  x,  this.y  =  y;    }    add(p)  {        this.x  +=  p.x,  this.y  +=  p.y;    } } class  MyNodeList  extends  NodeList  {...} let  x  =  “outer”;  {let  x  =  “inner”;  ...} const  TAU  =  2  *  Math.PI; • • • • • • • • • • • function  f(a  =  1,  b  =  2  *  a)  {...} let  rotateArray  =  (h,  ...t)  =>  t.push(h); let  a  =  [1,  2,  3];  rotateArray(0,  ...a); let  b  =  [0,  ...a,  4,  5,  6]; export  function  transcode(src,  url)  {...} import  {keys,  entries}  from  “@iter”; for  (let  [k,v]  of  entries(o))  print(k,v); let  eager  =  [for  (v  of  values(o))  2  *  v]; let  lazy    =  (for  (v  of  values(o))  2  *  v); function  iter()  {  return  {next()  {...};  } function*  gen()  {  yield  1;  yield  2;  }
  • 10. Harmony - ES6, cont • • • • Friday, November 29, 13 console.log(`interpolate  ${x}`); let  lexer  =  /w+|d+/y;  //  y  for  stickY map  =  Map([[‘key’,  42],  [obj,  “foo”]]); map.get(‘key’)  //  42 map.get(obj)      //  “foo” map.set(obj,  “bar”) map.get(obj)  //  “bar” map.size          //  2 for  (let  [k,  v]  of  map)  print(k,  v) map.delete(‘key’);  map.size  //  1 set  =  Set([0,  1,  2,  3]); set.has(0)  //  true set.add(9) set.size  //  5 for  (let  elt  of  set)  print(elt) set.delete(9);  set.size  //  4 • • • let  objectCache  =  WeakMap();  //  advanced • • • • • • • const  Triangle  =  new  ArrayType(Point,  3); var  proxy  =  new  Proxy(target,  handler); const  Point  =    new  StructType({x:  uint32,  y:  uint32}); {  function  in_block()  {  return  42;  }  ...  } let  {x,  y}  =  aPoint; let  [v1,  v2,  v3]  =  aTriangle; Object.assign(target,  source); Object.mixin(target,  source); Symbols,  many  new  methods,  more...
  • 11. Harmony - ES6 Compat Friday, November 29, 13
  • 12. ES6 Resources • • • • Friday, November 29, 13 https://github.com/google/traceur-compiler http://kangax.github.io/es5-compat-table/es6/ http://people.mozilla.org/~jorendorff/es6-draft.html http://wiki.ecmascript.org/doku.php? id=harmony:specification_drafts
  • 13. Harmony - ES7 • Object.observe(target,  observer) //  http://wiki.ecmascript.org/doku.php?id=harmony:observe • SIMD  intrinsics,  e.g.  SIMD.add(a,  b) //  https://github.com/johnmccutchan/ecmascript_simd • Friday, November 29, 13 Value  objects  -­‐  deep  dive  ahead
  • 14. Value Objects • int64, uint64 • int32x4, int32x8 (SIMD) • float32 (to/from Float32Array today) • float32x4, float32x8 (SIMD) • bignum • decimal • rational • complex Friday, November 29, 13
  • 15. Overloadable Operators •| ^ & •== •< <= •<< >> >>> •+ •* / % •~ boolean-test Friday, November 29, 13 unary- unary+
  • 16. Preserving Boolean Algebra • != and ! are not overloadable, to preserve identities including • X ? A : B <=> !X ? B : A • !(X && Y) <=> !X || !Y • !(X || Y) <=> !X && !Y <=> !(X == Y) • X != Y Friday, November 29, 13
  • 17. Preserving Relational Relations • > and >= are derived from < and <= as follows: • A > B <=> B < A • A >= B <=> B <= A • We provide <= in addition to < rather than derive A <= B from !(B < A) in order to allow the <= overloading to match the same value object’s == semantics -- and for special cases, e.g., unordered values (NaNs) Friday, November 29, 13
  • 18. Strict Equality Operators • The strict equality operators, === and !==, cannot be overloaded • They work on frozen-by-definition value objects via a structural recursive strict equality test (beware, NaN !== NaN) • Same-object-reference remains a fast-path optimization Friday, November 29, 13
  • 19. Why Not Double Dispatch? • Left-first asymmetry (v value, n number): •v •n + n ==> v.add(n) + v ==> v.radd(n) • Anti-modular: exhaustive other-operand type enumeration required in operator method bodies • Consequent loss of compositionality: complex and rational cannot be composed to make ratplex without modifying source or wrapping in proxies Friday, November 29, 13
  • 20. Cacheable Multimethods • Proposed in 2009 by Christian Plesner Hansen (Google) in esdiscuss • Avoids double-dispatch drawbacks from last slide: binary operators implemented by 2-ary functions for each pair of types • Supports Polymorphic Inline Cache (PIC) optimizations (Christian was on the V8 team) • Background reading: [Chambers 1992] Friday, November 29, 13
  • 21. Binary Operator Example • For the expression v + u • Let p = v.[[Get]](@@ADD) • If p is not a Set, throw a TypeError • Let q = u.[[Get]](@@ADD_R) • If q is not a Set, throw a TypeError • Let r = p intersect q • If r.size != 1 throw a TypeError • Let f = r[0]; if f is not a function, throw • Evaluate f(v, u) and return the result Friday, November 29, 13
  • 22. API Idea from CPH 2009 function addPointAndNumber(a, b) { return Point(a.x + b, a.y + b); } Function.defineOperator('+', addPointAndNumber, Point, Number); function addNumberAndPoint(a, b) { return Point(a + b.x, a + b.y); } Function.defineOperator('+', addNumberAndPoint, Number, Point); function addPoints(a, b) { return Point(a.x + b.x, a.y + b.y); } Function.defineOperator('+', addPoints, Point, Point); Friday, November 29, 13
  • 23. Literal Syntax • int64(0) • uint64(0) • float32(0) • bignum(0) • decimal(0) ==> 0L // as in C# ==> 0UL // as in C# ==> 0f // as in C# ==> 0n // avoid i/I ==> 0m // or M, C/F# • We want a syntax extension mechanism, but declarative not runtime API • This means new syntax for operator and suffix definition Friday, November 29, 13
  • 24. Straw Value Object Declaration Syntax value class point2d { // implies typeof “point2d” constructor point2d(x, y) { this.x = +x; this.y = +y; // implicit Object.freeze(this) on return } point2d + number (a, b) { return point2d(a.x + b, a.y + b); } number + point2d (a, b) { return point2d(a + b.x, a + b.y); } point2d + point2d (a, b) { return point2d(a.x + b.x, a.y + b.y); } // more operators, suffix declaration handler, etc. } Friday, November 29, 13
  • 25. SIMD Single Instruction, Multiple Data (SSE, NEON, etc.) Friday, November 29, 13
  • 26. SIMD intrinsics • • • • Friday, November 29, 13 Game, DSP, other low-level hackers need them John McCutchan added them to DartVM Dart-to-the-heart? No, Dart2JS needs ‘em in JS A Google, Intel, Mozilla, Ecma TC39 joint
  • 27. Possible ES7 Polyfillable SIMD API https://github.com/johnmccutchan/ecmascript_simd var a = float32x4(1.0, 2.0, 3.0, 4.0); var b = float32x4(5.0, 6.0, 7.0, 8.0); var c = SIMD.add(a, b); // Also SIMD.{sub,mul,div,neg,abs} etc. // See ES7 Value Objects for some sweet // operator overloading sugar. Friday, November 29, 13
  • 28. Why Operator Syntax Matters From Cameron Purdy’s blog: “At a client gig, they were doing business/financial coding, so were using BigDecimal. Of course, .add() and friends is too difficult, so they ended up with roughly: BigDecimal subA = ... BigDecimal subB = ... BigDecimal total = new BigDecimal( subA.doubleValue() + subB.doubleValue() ); It was beautiful.” Posted by Bob McWhirter on October 31, 2005 at 08:17 AM EST Friday, November 29, 13
  • 31. WebRTC • • • • • Friday, November 29, 13 Video/audio/data p2p & n-way realtime browser-based communication Peer-to-peer file sharing: https://www.sharefest.me/ A simple two-party videocall: https://apprtc.webrtc.org/ Multiparty conferences (up to 4 people): http://tokbox.com/opentok/ quick-start/demo.html Real-time multiplayer gaming: https://developer.mozilla.org/en-US/demos/ detail/bananabread/launch
  • 34. WebRTC Sample JS • • • var  pc  =  new  RTCPeerConnection(); var  localVideo  =  document.getElementById(“local”); navigator.getUserMedia(    {video:  true,  audio:  true},    function  (stream)  {        pc.addStream(stream);        //  See  https://github.com/HenrikJoreteg/attachMediaStream        attachMediaStream(localVideo,  stream);    },    function  ()  {  console.log(“failed  to  get  video  camera”)  } ); Friday, November 29, 13
  • 36. WebRTC Resources • • • • Friday, November 29, 13 https://speakerdeck.com/henrikjoreteg/webrtc-jsconfbrazil-2013 https://github.com/HenrikJoreteg/jsconfbr http://iswebrtcreadyyet.com/ https://talky.io/
  • 37. Networking • • • • • • Friday, November 29, 13 Layering hurts (Sam Ruby, OSCON 2005? I forget) DNS lookup, HTML load, img and script step on each other and power up the radio just as it is powering down 10kbs on LTE, not great Here, underused on server side: SPDY; coming: HTTP2 We can fix things incrementally with better coordination
  • 38. Privacy, Trust, User Agency • • • Friday, November 29, 13 Mozilla won “Most Trusted for Privacy” award in 2012 Working to earn it: • • • • Sync encrypts client-side, but key mgmt beyond most users Verified builds on Linux, using bootstrapped/verified clang Use as a trust anchor to verify Mozilla services Yes, Mozilla is doing services: https://services.mozilla.com/ What would a user-first Web of services look like?
  • 39. Servo • Friday, November 29, 13 A brief demo showing of Mozilla’s new parallel/safe engine...
  • 40. Conclusion • • • • • • Friday, November 29, 13 First they said that JS or the Web stack couldn’t do “Rich Internet Applications” Then they said it couldn’t be fast enough Then they said it couldn’t be fixed Wrong every time! Always bet on {JS, HTML, WebGL, ...} Really, always bet on Web Developers