SlideShare une entreprise Scribd logo
1  sur  44
Télécharger pour lire hors ligne
Tamarin and ECMAScript 4
      John Resig (ejohn.org)
       Mozilla Corporation
The Big Picture
                     ECMAScript 3


JavaScript 1.5   ActionScript 2      JScript        Etc.


SpiderMonkey         AVM          JScript Engine KJS (Apple)


   Rhino                                           Opera
The Direction
                         ECMAScript 4


JavaScript 2         ActionScript 4      JScript       Etc.


                                        Screaming
               Tamarin                              KJS (Apple)
                                         Monkey


                                                      Opera
Tamarin
    Tamarin
✦
    ✦ New Virtual Machine from Adobe
    ✦ Perfect for ActionScript
      ✦ (a mutant cousin of JavaScript 2)

    The Three Monkeys:
✦
    ✦ ActionMonkey
    ✦ ScreamingMonkey
    ✦ IronMonkey
Three Monkies
    ActionMonkey
✦
    ✦ Integrating Tamarin into SpiderMonkey
    ✦ Powering Firefox 4 (?) + JavaScript 2

    ScreamingMonkey
✦
    ✦ Bringing Tamarin into Internet Explorer
    ✦ (Kicking and screaming?)

    IronMonkey
✦
    ✦ Bringing Python + Ruby to Tamarin
Jav
                a




1999
                 Sc
                      rip
                         t1
                            .5
            Jav
                a



2005
                 Sc
                      rip
                         t1
                            .6
            Jav
                a
2006
                 Sc
                      rip
                         t1
                            .7
            Jav
                a
2008
                 Sc
                      rip
                         t1
                            .8
            Ja
                                     Path to JavaScript 2




               va
                  S   cr
2008-2009




                        ip
                          t
                                 2
The JavaScript Language
    Current:
✦
    JavaScript 1.5 (ECMAScript 3)
    JavaScript 1.6 (Firefox 1.5)
✦

    JavaScript 1.7 (Firefox 2)
✦

    JavaScipt 1.8 (Firefox 3)
✦

    ...
✦

    JavaScript 2 (ECMAScript 4)
✦
ECMAScript 4 Goals
    Compatible with ECMAScript 3
✦

    Suitable to developing large systems
✦

    Allow for reusable libraries
✦

    Merge previous efforts (ActionScript)
✦

    Fix ECMAScript 3 bugs
✦

    Keep it usable for small programs
✦
Features
    Classes and Interfaces
✦

    Packages and Namespaces
✦

    Type Annotations
✦

    Strict Verification
✦

    Optimization
✦

    Syntax Shortcuts
✦

    Iterators and Generators
✦

    Self-hosting
✦
Classes
Classes
    class Programmer {
✦
       var name;
       var city = “Boston, MA”;
       const interest = “computers”;
       function work() {}
    }
    var p = new Programmer;
✦
    p.name = “John”;
    p.work();
    p.work.apply( someotherp );
    p.interest = “science”; // Error
Dynamic Classes
    dynamic class Programmer {
✦
      var name;
      var city = “Boston, MA”;
      const interest = “computers”;
      function work() {}
    }
    var p = new Programmer;
✦
    p.lastName = “Resig”;
    for ( var i in p )
       alert( i );
    // alert( “Resig” );
Getters and Setters
    class Programmer {
✦
       var _name;
       function get name(){ return _name; }
       function set name(value){
         _name = value + “ Resig”;
       }
    }
    var p = new Programmer;
✦
    p.name = “John”;
    alert( p.name );
    // “John Resig”
Catch-Alls
    dynamic class Programmer {
✦
      meta function get(name) { ... }
      meta function set(name, value) {
        alert(“Setting “ + name + “ to “ + value);
      }
    }
    var p = new Programmer
✦
    p.name = “John”;
    // alert(“Setting name to John”);
Inheritance
    class Artist {
✦
       function draw() { alert(“Drawing!”); }
    }
    class Designer extends Artist {
       override function draw() {
         alert(“Designing!”);
       }
    }
    var d = new Designer
✦
    d.draw();
    // alert(“Designing!”);
Inheritance (cont.)
    ‘final’ methods can’t be overriden
✦

    class Artist {
✦
       final function draw() {alert(“Drawing!”);}
    }
    class Designer extends Artist {
       // ERROR: Can’t override draw!
       override function draw() {
          alert(“Designing!”);
       }
    }
Inheritance (cont.)
    ‘final’ classes can’t be inherited from
✦

    final class Artist {
✦
      function draw() { alert(“Drawing!”); }
    }

    // ERROR: Can’t inherit from Artist
    class Designer extends Artist {
       override function draw() {
         alert(“Designing!”);
       }
    }
Metaclass
    Provide global functions and properties on
✦
    a class object
    class Users {
✦
       static function find( name ) {
         // ...
       }
    }
    Users.find( “John” );
✦
Interfaces
    Verify that a class implements another
✦

    interface Artist {
✦
       function draw();
    }
    class Designer implements Artist {
       function draw() { alert(“Designing!”); }
    }
    var d = new Designer();
✦
    if ( d is Artist )
       alert(“Designers are Artists!”);
Types
Numbers
    Numbers are now broken down into:
✦
    ✦ byte
    ✦ int
    ✦ uint
    ✦ double (ECMAScript 3-style Number)
    ✦ decimal
Type Annotations
    var name : string = “John”;
✦

    let x : double = 5.3;
✦

    function stuff( x: int, obj: Object ) :
✦
    boolean {}
Function Types
    Only return specific types:
✦
    function isValid() : boolean { }
    Only be used on certain objects types:
✦
    function every( this: Array, value: int ) {
       for ( var i = 0; i < this.length; i++ )
          alert( this[i] );
    }
    every.call( [0,1,2], 3 );
    // alert(0); alert(1); alert(2);
    every.call({a: “b”}, 4);
    // ERROR
Rest Arguments
    function stuff( name, ...values ){
✦
      alert( values.length );
    }
    stuff( “John”, 1, 2, 3, 4 );
✦
    // alert( 4 );
    function stuff( name : string, ...values : [int] ) : void {
✦
      alert( values.length );
    }
Union and Any Types
    var test : (string, int, double) = “test”;
✦
    test = 3;
    test = false; // ERROR
    type AnyNumber = (byte, int, double, decimal, uint);
✦



    var test : AnyNumber = 3
✦

    These are equivalent:
✦
    ✦ var test : * = “test”;
    ✦ var test = “test”;
Type Definitions
    type Point = { x: int, y: int };
✦

    var p : Point = { x: 3, y: 24 };
✦
Nullability
    Prevent variables from accepting null
✦
    values
    var name : * = “John”;
✦

    var name : String! = “John”;
✦
    name = “Ted”;
    name = null; // ERROR
    function test( name: String? ) {
✦
      alert( name );
    }
Initialization
    class User {
✦
       var name : string!; // Must be initialized
       var last : string!;
       function User( n, l ) : name = n, last = l {
          // ...
       }
    }
“like”
    type Point = { x: int, y: int };
✦

    if ( { x: 3, y: 5 } like Point )
✦
       alert( “That looks like a point to me!” );
    if ( !({ x: 3 } like Point) )
✦
       alert( “Not a point!” );
    // Loop over array-like things:
✦
    function every( a: like { length: uint } ) {
       for ( var i = 0; i < a.length; i++ )
         alert( a[i] );
    }
“wrap”
    Force a type if compatible one doesn’t
✦
    exist
    type Point = { x: int, y: int };
✦
    var p: wrap Point = { x: 3, y: 8 };
    var p: Point = { x: 3, y: 8 } wrap Point;
✦

    var p: Point = { x: 3, y: 8 } : Point;
✦
Parameterized Types
    var m: Map.<Object, string>;
✦

    class Point.<T> {
✦
       var x: T, y: T;
    }
    var p = new Point.<double>;
✦
    p.x = 3.0;
    p.y = 5.0;
Structure
For .. Each
    For each loops through values
✦

    let s = “”;
✦
    for each ( let n in [“a”,”b”,”c”] )
        s += n;
    alert(s);
    // “abc”
let statements
    for ( let i = 0; i < a.length; i++ )
✦
        alert( a[i] );
    // i is undefined
    Using block statements:
✦
    {
        let x = 5;
        {
           let x = 6;
           alert( x ); // 6
        }
        alert( x ); // 5
    }
let (cont.)
    let expressions:
✦
    var a = 5;
    var x = 10 + (let (a=3) a) + a*a;
    // x == 19
    let blocks:
✦
    let ( a=3 ) {
       alert( a ); // 3
    }
    // a is undefined
    let a = function(){ };
✦
Packages
    package simple.tracker {
✦
      internal var count: int = 0;
      public function add(){
        return ++count;
      }
    }
    import simple.tracker.*
✦
    alert( add() ); // alert(“1”)
    count // ERROR, undefined
Namespaces
    namespace extra = “extra”;
✦

    Pre-defined namespaces:
✦
    ✦ __ES4__
      ✦ intrinsic
      ✦ iterator
      ✦ meta

    import dojo.query;
✦
    import jquery.query;
    dojo::query(“#foo”)
    jquery::query(“div > .foo”)
Namespaces (cont.)
    import dojo.query;
✦
    import jquery.query;
    use namespace dojo;
    query(“#foo”) // using dojo

    use namespace jquery;
    query(“div > .foo”) // using jquery
Multimethods
    generic function intersect(s1, s2);
✦
    generic function intersect(s1: Shape, s2: Shape ) {
      // ...
    }
    generic function intersect(s1: Rect, s2: Rect ) {
      // ...
    }
Program Units
    use unit jQuery “http://jquery.com/jQuery”
✦
    import com.jquery.*;
    new jQuery();
    unit jQuery {
✦
      use unit Selectors “lib/Selectors”;
      package com.jquery {
         class jQuery {
            function find() : jQuery {}
         }
      }
    }
Operator Overloading
    class Complex! { ... }
✦


    generic intrinsic function +(a: Complex, b: Complex)
      new Complex( a.real + b.real, a.imag + b.imag )

    generic intrinsic function +(a: Complex, b: AnyNumber)
      a + Complex(b)

    generic intrinsic function +(a: AnyNumber, b: Complex)
      Complex(a) + b
Self-Hosting
Map.es
    The reference implementation’s classes are
✦
    written in ECMAScript
    package
✦
    {
      use namespace intrinsic;
      use default namespace public;
      intrinsic class Map.<K,V>
      {
        static const length = 2;
        function Map(equals=intrinsic::===, hashcode=intrinsic::hashcode)
            : equals = equals
            , hashcode = hashcode
            , element_count = 0
        {
        }
        // ...
    }
More Info
    ECMAScript site:
✦
    http://ecmascript.org/
    ECMAScript 4 White Paper Overview:
✦
    http://www.ecmascript.org/es4/spec/overview.pdf

    Blogging:
✦
    http://ejohn.org/

Contenu connexe

Tendances

Monitoring distributed (micro-)services
Monitoring distributed (micro-)servicesMonitoring distributed (micro-)services
Monitoring distributed (micro-)servicesRafael Winterhalter
 
A Re-Introduction to JavaScript
A Re-Introduction to JavaScriptA Re-Introduction to JavaScript
A Re-Introduction to JavaScriptSimon Willison
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesGanesh Samarthyam
 
How do you create a programming language for the JVM?
How do you create a programming language for the JVM?How do you create a programming language for the JVM?
How do you create a programming language for the JVM?Federico Tomassetti
 
What's new in Scala 2.13?
What's new in Scala 2.13?What's new in Scala 2.13?
What's new in Scala 2.13?Hermann Hueck
 
Denis Lebedev, Swift
Denis  Lebedev, SwiftDenis  Lebedev, Swift
Denis Lebedev, SwiftYandex
 
Code generation for alternative languages
Code generation for alternative languagesCode generation for alternative languages
Code generation for alternative languagesRafael Winterhalter
 
Understanding Java byte code and the class file format
Understanding Java byte code and the class file formatUnderstanding Java byte code and the class file format
Understanding Java byte code and the class file formatRafael Winterhalter
 
Programming in Scala: Notes
Programming in Scala: NotesProgramming in Scala: Notes
Programming in Scala: NotesRoberto Casadei
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Susan Potter
 
Java Keeps Throttling Up!
Java Keeps Throttling Up!Java Keeps Throttling Up!
Java Keeps Throttling Up!José Paumard
 
Cocoa Design Patterns in Swift
Cocoa Design Patterns in SwiftCocoa Design Patterns in Swift
Cocoa Design Patterns in SwiftMichele Titolo
 
Kotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime PerformanceKotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime Performanceintelliyole
 
Joe Bew - Apprendi un nuovo linguaggio sfruttando il TDD e il Clean Code - Co...
Joe Bew - Apprendi un nuovo linguaggio sfruttando il TDD e il Clean Code - Co...Joe Bew - Apprendi un nuovo linguaggio sfruttando il TDD e il Clean Code - Co...
Joe Bew - Apprendi un nuovo linguaggio sfruttando il TDD e il Clean Code - Co...Codemotion
 

Tendances (20)

Java Generics - by Example
Java Generics - by ExampleJava Generics - by Example
Java Generics - by Example
 
Monitoring distributed (micro-)services
Monitoring distributed (micro-)servicesMonitoring distributed (micro-)services
Monitoring distributed (micro-)services
 
A Re-Introduction to JavaScript
A Re-Introduction to JavaScriptA Re-Introduction to JavaScript
A Re-Introduction to JavaScript
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
How do you create a programming language for the JVM?
How do you create a programming language for the JVM?How do you create a programming language for the JVM?
How do you create a programming language for the JVM?
 
Javantura v2 - All Together Now - making Groovy and Scala sing together - Din...
Javantura v2 - All Together Now - making Groovy and Scala sing together - Din...Javantura v2 - All Together Now - making Groovy and Scala sing together - Din...
Javantura v2 - All Together Now - making Groovy and Scala sing together - Din...
 
What's new in Scala 2.13?
What's new in Scala 2.13?What's new in Scala 2.13?
What's new in Scala 2.13?
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
 
Denis Lebedev, Swift
Denis  Lebedev, SwiftDenis  Lebedev, Swift
Denis Lebedev, Swift
 
Unit testing concurrent code
Unit testing concurrent codeUnit testing concurrent code
Unit testing concurrent code
 
Code generation for alternative languages
Code generation for alternative languagesCode generation for alternative languages
Code generation for alternative languages
 
Understanding Java byte code and the class file format
Understanding Java byte code and the class file formatUnderstanding Java byte code and the class file format
Understanding Java byte code and the class file format
 
Programming in Scala: Notes
Programming in Scala: NotesProgramming in Scala: Notes
Programming in Scala: Notes
 
Swift Introduction
Swift IntroductionSwift Introduction
Swift Introduction
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
 
Java Keeps Throttling Up!
Java Keeps Throttling Up!Java Keeps Throttling Up!
Java Keeps Throttling Up!
 
Cocoa Design Patterns in Swift
Cocoa Design Patterns in SwiftCocoa Design Patterns in Swift
Cocoa Design Patterns in Swift
 
Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
 
Kotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime PerformanceKotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime Performance
 
Joe Bew - Apprendi un nuovo linguaggio sfruttando il TDD e il Clean Code - Co...
Joe Bew - Apprendi un nuovo linguaggio sfruttando il TDD e il Clean Code - Co...Joe Bew - Apprendi un nuovo linguaggio sfruttando il TDD e il Clean Code - Co...
Joe Bew - Apprendi un nuovo linguaggio sfruttando il TDD e il Clean Code - Co...
 

En vedette

Ethan b the green tree pythons
Ethan b the green tree pythonsEthan b the green tree pythons
Ethan b the green tree pythonsginageo65
 
Lily o golden lion tamarin monkey
Lily o golden lion tamarin monkeyLily o golden lion tamarin monkey
Lily o golden lion tamarin monkeyginageo65
 
Cass t the golden lion tamarin
Cass t the golden lion tamarinCass t the golden lion tamarin
Cass t the golden lion tamaringinageo65
 
Martin_L_Gold lion tamarin monkey
Martin_L_Gold lion tamarin monkeyMartin_L_Gold lion tamarin monkey
Martin_L_Gold lion tamarin monkeyginageo65
 

En vedette (6)

Ethan b the green tree pythons
Ethan b the green tree pythonsEthan b the green tree pythons
Ethan b the green tree pythons
 
Bk
BkBk
Bk
 
Lily o golden lion tamarin monkey
Lily o golden lion tamarin monkeyLily o golden lion tamarin monkey
Lily o golden lion tamarin monkey
 
Cass t the golden lion tamarin
Cass t the golden lion tamarinCass t the golden lion tamarin
Cass t the golden lion tamarin
 
Martin_L_Gold lion tamarin monkey
Martin_L_Gold lion tamarin monkeyMartin_L_Gold lion tamarin monkey
Martin_L_Gold lion tamarin monkey
 
Plant adaptations
Plant adaptationsPlant adaptations
Plant adaptations
 

Similaire à Tamarin and ECMAScript 4

Tamarin And Ecmascript 4
Tamarin And Ecmascript 4Tamarin And Ecmascript 4
Tamarin And Ecmascript 4elliando dias
 
JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)jeresig
 
What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?Christophe Porteneuve
 
javascript teach
javascript teachjavascript teach
javascript teachguest3732fa
 
JSBootcamp_White
JSBootcamp_WhiteJSBootcamp_White
JSBootcamp_Whiteguest3732fa
 
Functional Javascript
Functional JavascriptFunctional Javascript
Functional Javascriptguest4d57e6
 
History of jQuery
History of jQueryHistory of jQuery
History of jQueryjeresig
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesSiarhei Barysiuk
 
Building a JavaScript Library
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Libraryjeresig
 
Groovy and Grails talk
Groovy and Grails talkGroovy and Grails talk
Groovy and Grails talkdesistartups
 
Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9tomaspavelka
 
Programming Android Application in Scala.
Programming Android Application in Scala.Programming Android Application in Scala.
Programming Android Application in Scala.Brian Hsu
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptCaridy Patino
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Troy Miles
 
Introduction to Scala for Java Developers
Introduction to Scala for Java DevelopersIntroduction to Scala for Java Developers
Introduction to Scala for Java DevelopersMichael Galpin
 
Shibuya.js Lightning Talks
Shibuya.js Lightning TalksShibuya.js Lightning Talks
Shibuya.js Lightning Talksjeresig
 
JSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph PicklJSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph PicklChristoph Pickl
 

Similaire à Tamarin and ECMAScript 4 (20)

Tamarin And Ecmascript 4
Tamarin And Ecmascript 4Tamarin And Ecmascript 4
Tamarin And Ecmascript 4
 
JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)
 
What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
 
Javascript status 2016
Javascript status 2016Javascript status 2016
Javascript status 2016
 
javascript teach
javascript teachjavascript teach
javascript teach
 
JSBootcamp_White
JSBootcamp_WhiteJSBootcamp_White
JSBootcamp_White
 
Functional Javascript
Functional JavascriptFunctional Javascript
Functional Javascript
 
History of jQuery
History of jQueryHistory of jQuery
History of jQuery
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
 
Building a JavaScript Library
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Library
 
Groovy and Grails talk
Groovy and Grails talkGroovy and Grails talk
Groovy and Grails talk
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
 
Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9
 
Programming Android Application in Scala.
Programming Android Application in Scala.Programming Android Application in Scala.
Programming Android Application in Scala.
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScript
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
 
Introduction to Scala for Java Developers
Introduction to Scala for Java DevelopersIntroduction to Scala for Java Developers
Introduction to Scala for Java Developers
 
Shibuya.js Lightning Talks
Shibuya.js Lightning TalksShibuya.js Lightning Talks
Shibuya.js Lightning Talks
 
JSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph PicklJSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph Pickl
 

Plus de jeresig

Does Coding Every Day Matter?
Does Coding Every Day Matter?Does Coding Every Day Matter?
Does Coding Every Day Matter?jeresig
 
Accidentally Becoming a Digital Librarian
Accidentally Becoming a Digital LibrarianAccidentally Becoming a Digital Librarian
Accidentally Becoming a Digital Librarianjeresig
 
2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)jeresig
 
Computer Vision as Art Historical Investigation
Computer Vision as Art Historical InvestigationComputer Vision as Art Historical Investigation
Computer Vision as Art Historical Investigationjeresig
 
Hacking Art History
Hacking Art HistoryHacking Art History
Hacking Art Historyjeresig
 
Using JS to teach JS at Khan Academy
Using JS to teach JS at Khan AcademyUsing JS to teach JS at Khan Academy
Using JS to teach JS at Khan Academyjeresig
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art Historyjeresig
 
NYARC 2014: Frick/Zeri Results
NYARC 2014: Frick/Zeri ResultsNYARC 2014: Frick/Zeri Results
NYARC 2014: Frick/Zeri Resultsjeresig
 
EmpireJS: Hacking Art with Node js and Image Analysis
EmpireJS: Hacking Art with Node js and Image AnalysisEmpireJS: Hacking Art with Node js and Image Analysis
EmpireJS: Hacking Art with Node js and Image Analysisjeresig
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art Historyjeresig
 
JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)jeresig
 
Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)jeresig
 
jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)jeresig
 
jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)jeresig
 
jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)jeresig
 
jQuery Mobile
jQuery MobilejQuery Mobile
jQuery Mobilejeresig
 
jQuery Open Source (Fronteer 2011)
jQuery Open Source (Fronteer 2011)jQuery Open Source (Fronteer 2011)
jQuery Open Source (Fronteer 2011)jeresig
 
Holistic JavaScript Performance
Holistic JavaScript PerformanceHolistic JavaScript Performance
Holistic JavaScript Performancejeresig
 
New Features Coming in Browsers (RIT '09)
New Features Coming in Browsers (RIT '09)New Features Coming in Browsers (RIT '09)
New Features Coming in Browsers (RIT '09)jeresig
 
Introduction to jQuery (Ajax Exp 2007)
Introduction to jQuery (Ajax Exp 2007)Introduction to jQuery (Ajax Exp 2007)
Introduction to jQuery (Ajax Exp 2007)jeresig
 

Plus de jeresig (20)

Does Coding Every Day Matter?
Does Coding Every Day Matter?Does Coding Every Day Matter?
Does Coding Every Day Matter?
 
Accidentally Becoming a Digital Librarian
Accidentally Becoming a Digital LibrarianAccidentally Becoming a Digital Librarian
Accidentally Becoming a Digital Librarian
 
2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)
 
Computer Vision as Art Historical Investigation
Computer Vision as Art Historical InvestigationComputer Vision as Art Historical Investigation
Computer Vision as Art Historical Investigation
 
Hacking Art History
Hacking Art HistoryHacking Art History
Hacking Art History
 
Using JS to teach JS at Khan Academy
Using JS to teach JS at Khan AcademyUsing JS to teach JS at Khan Academy
Using JS to teach JS at Khan Academy
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art History
 
NYARC 2014: Frick/Zeri Results
NYARC 2014: Frick/Zeri ResultsNYARC 2014: Frick/Zeri Results
NYARC 2014: Frick/Zeri Results
 
EmpireJS: Hacking Art with Node js and Image Analysis
EmpireJS: Hacking Art with Node js and Image AnalysisEmpireJS: Hacking Art with Node js and Image Analysis
EmpireJS: Hacking Art with Node js and Image Analysis
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art History
 
JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)
 
Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)
 
jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)
 
jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)
 
jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)
 
jQuery Mobile
jQuery MobilejQuery Mobile
jQuery Mobile
 
jQuery Open Source (Fronteer 2011)
jQuery Open Source (Fronteer 2011)jQuery Open Source (Fronteer 2011)
jQuery Open Source (Fronteer 2011)
 
Holistic JavaScript Performance
Holistic JavaScript PerformanceHolistic JavaScript Performance
Holistic JavaScript Performance
 
New Features Coming in Browsers (RIT '09)
New Features Coming in Browsers (RIT '09)New Features Coming in Browsers (RIT '09)
New Features Coming in Browsers (RIT '09)
 
Introduction to jQuery (Ajax Exp 2007)
Introduction to jQuery (Ajax Exp 2007)Introduction to jQuery (Ajax Exp 2007)
Introduction to jQuery (Ajax Exp 2007)
 

Dernier

"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
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
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
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
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
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
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
 
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
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
"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
 
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
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Dernier (20)

"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
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
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
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
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
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
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
 
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
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
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
 
"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
 
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
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

Tamarin and ECMAScript 4

  • 1. Tamarin and ECMAScript 4 John Resig (ejohn.org) Mozilla Corporation
  • 2. The Big Picture ECMAScript 3 JavaScript 1.5 ActionScript 2 JScript Etc. SpiderMonkey AVM JScript Engine KJS (Apple) Rhino Opera
  • 3. The Direction ECMAScript 4 JavaScript 2 ActionScript 4 JScript Etc. Screaming Tamarin KJS (Apple) Monkey Opera
  • 4. Tamarin Tamarin ✦ ✦ New Virtual Machine from Adobe ✦ Perfect for ActionScript ✦ (a mutant cousin of JavaScript 2) The Three Monkeys: ✦ ✦ ActionMonkey ✦ ScreamingMonkey ✦ IronMonkey
  • 5. Three Monkies ActionMonkey ✦ ✦ Integrating Tamarin into SpiderMonkey ✦ Powering Firefox 4 (?) + JavaScript 2 ScreamingMonkey ✦ ✦ Bringing Tamarin into Internet Explorer ✦ (Kicking and screaming?) IronMonkey ✦ ✦ Bringing Python + Ruby to Tamarin
  • 6. Jav a 1999 Sc rip t1 .5 Jav a 2005 Sc rip t1 .6 Jav a 2006 Sc rip t1 .7 Jav a 2008 Sc rip t1 .8 Ja Path to JavaScript 2 va S cr 2008-2009 ip t 2
  • 7. The JavaScript Language Current: ✦ JavaScript 1.5 (ECMAScript 3) JavaScript 1.6 (Firefox 1.5) ✦ JavaScript 1.7 (Firefox 2) ✦ JavaScipt 1.8 (Firefox 3) ✦ ... ✦ JavaScript 2 (ECMAScript 4) ✦
  • 8. ECMAScript 4 Goals Compatible with ECMAScript 3 ✦ Suitable to developing large systems ✦ Allow for reusable libraries ✦ Merge previous efforts (ActionScript) ✦ Fix ECMAScript 3 bugs ✦ Keep it usable for small programs ✦
  • 9. Features Classes and Interfaces ✦ Packages and Namespaces ✦ Type Annotations ✦ Strict Verification ✦ Optimization ✦ Syntax Shortcuts ✦ Iterators and Generators ✦ Self-hosting ✦
  • 11. Classes class Programmer { ✦ var name; var city = “Boston, MA”; const interest = “computers”; function work() {} } var p = new Programmer; ✦ p.name = “John”; p.work(); p.work.apply( someotherp ); p.interest = “science”; // Error
  • 12. Dynamic Classes dynamic class Programmer { ✦ var name; var city = “Boston, MA”; const interest = “computers”; function work() {} } var p = new Programmer; ✦ p.lastName = “Resig”; for ( var i in p ) alert( i ); // alert( “Resig” );
  • 13. Getters and Setters class Programmer { ✦ var _name; function get name(){ return _name; } function set name(value){ _name = value + “ Resig”; } } var p = new Programmer; ✦ p.name = “John”; alert( p.name ); // “John Resig”
  • 14. Catch-Alls dynamic class Programmer { ✦ meta function get(name) { ... } meta function set(name, value) { alert(“Setting “ + name + “ to “ + value); } } var p = new Programmer ✦ p.name = “John”; // alert(“Setting name to John”);
  • 15. Inheritance class Artist { ✦ function draw() { alert(“Drawing!”); } } class Designer extends Artist { override function draw() { alert(“Designing!”); } } var d = new Designer ✦ d.draw(); // alert(“Designing!”);
  • 16. Inheritance (cont.) ‘final’ methods can’t be overriden ✦ class Artist { ✦ final function draw() {alert(“Drawing!”);} } class Designer extends Artist { // ERROR: Can’t override draw! override function draw() { alert(“Designing!”); } }
  • 17. Inheritance (cont.) ‘final’ classes can’t be inherited from ✦ final class Artist { ✦ function draw() { alert(“Drawing!”); } } // ERROR: Can’t inherit from Artist class Designer extends Artist { override function draw() { alert(“Designing!”); } }
  • 18. Metaclass Provide global functions and properties on ✦ a class object class Users { ✦ static function find( name ) { // ... } } Users.find( “John” ); ✦
  • 19. Interfaces Verify that a class implements another ✦ interface Artist { ✦ function draw(); } class Designer implements Artist { function draw() { alert(“Designing!”); } } var d = new Designer(); ✦ if ( d is Artist ) alert(“Designers are Artists!”);
  • 20. Types
  • 21. Numbers Numbers are now broken down into: ✦ ✦ byte ✦ int ✦ uint ✦ double (ECMAScript 3-style Number) ✦ decimal
  • 22. Type Annotations var name : string = “John”; ✦ let x : double = 5.3; ✦ function stuff( x: int, obj: Object ) : ✦ boolean {}
  • 23. Function Types Only return specific types: ✦ function isValid() : boolean { } Only be used on certain objects types: ✦ function every( this: Array, value: int ) { for ( var i = 0; i < this.length; i++ ) alert( this[i] ); } every.call( [0,1,2], 3 ); // alert(0); alert(1); alert(2); every.call({a: “b”}, 4); // ERROR
  • 24. Rest Arguments function stuff( name, ...values ){ ✦ alert( values.length ); } stuff( “John”, 1, 2, 3, 4 ); ✦ // alert( 4 ); function stuff( name : string, ...values : [int] ) : void { ✦ alert( values.length ); }
  • 25. Union and Any Types var test : (string, int, double) = “test”; ✦ test = 3; test = false; // ERROR type AnyNumber = (byte, int, double, decimal, uint); ✦ var test : AnyNumber = 3 ✦ These are equivalent: ✦ ✦ var test : * = “test”; ✦ var test = “test”;
  • 26. Type Definitions type Point = { x: int, y: int }; ✦ var p : Point = { x: 3, y: 24 }; ✦
  • 27. Nullability Prevent variables from accepting null ✦ values var name : * = “John”; ✦ var name : String! = “John”; ✦ name = “Ted”; name = null; // ERROR function test( name: String? ) { ✦ alert( name ); }
  • 28. Initialization class User { ✦ var name : string!; // Must be initialized var last : string!; function User( n, l ) : name = n, last = l { // ... } }
  • 29. “like” type Point = { x: int, y: int }; ✦ if ( { x: 3, y: 5 } like Point ) ✦ alert( “That looks like a point to me!” ); if ( !({ x: 3 } like Point) ) ✦ alert( “Not a point!” ); // Loop over array-like things: ✦ function every( a: like { length: uint } ) { for ( var i = 0; i < a.length; i++ ) alert( a[i] ); }
  • 30. “wrap” Force a type if compatible one doesn’t ✦ exist type Point = { x: int, y: int }; ✦ var p: wrap Point = { x: 3, y: 8 }; var p: Point = { x: 3, y: 8 } wrap Point; ✦ var p: Point = { x: 3, y: 8 } : Point; ✦
  • 31. Parameterized Types var m: Map.<Object, string>; ✦ class Point.<T> { ✦ var x: T, y: T; } var p = new Point.<double>; ✦ p.x = 3.0; p.y = 5.0;
  • 33. For .. Each For each loops through values ✦ let s = “”; ✦ for each ( let n in [“a”,”b”,”c”] ) s += n; alert(s); // “abc”
  • 34. let statements for ( let i = 0; i < a.length; i++ ) ✦ alert( a[i] ); // i is undefined Using block statements: ✦ { let x = 5; { let x = 6; alert( x ); // 6 } alert( x ); // 5 }
  • 35. let (cont.) let expressions: ✦ var a = 5; var x = 10 + (let (a=3) a) + a*a; // x == 19 let blocks: ✦ let ( a=3 ) { alert( a ); // 3 } // a is undefined let a = function(){ }; ✦
  • 36. Packages package simple.tracker { ✦ internal var count: int = 0; public function add(){ return ++count; } } import simple.tracker.* ✦ alert( add() ); // alert(“1”) count // ERROR, undefined
  • 37. Namespaces namespace extra = “extra”; ✦ Pre-defined namespaces: ✦ ✦ __ES4__ ✦ intrinsic ✦ iterator ✦ meta import dojo.query; ✦ import jquery.query; dojo::query(“#foo”) jquery::query(“div > .foo”)
  • 38. Namespaces (cont.) import dojo.query; ✦ import jquery.query; use namespace dojo; query(“#foo”) // using dojo use namespace jquery; query(“div > .foo”) // using jquery
  • 39. Multimethods generic function intersect(s1, s2); ✦ generic function intersect(s1: Shape, s2: Shape ) { // ... } generic function intersect(s1: Rect, s2: Rect ) { // ... }
  • 40. Program Units use unit jQuery “http://jquery.com/jQuery” ✦ import com.jquery.*; new jQuery(); unit jQuery { ✦ use unit Selectors “lib/Selectors”; package com.jquery { class jQuery { function find() : jQuery {} } } }
  • 41. Operator Overloading class Complex! { ... } ✦ generic intrinsic function +(a: Complex, b: Complex) new Complex( a.real + b.real, a.imag + b.imag ) generic intrinsic function +(a: Complex, b: AnyNumber) a + Complex(b) generic intrinsic function +(a: AnyNumber, b: Complex) Complex(a) + b
  • 43. Map.es The reference implementation’s classes are ✦ written in ECMAScript package ✦ { use namespace intrinsic; use default namespace public; intrinsic class Map.<K,V> { static const length = 2; function Map(equals=intrinsic::===, hashcode=intrinsic::hashcode) : equals = equals , hashcode = hashcode , element_count = 0 { } // ... }
  • 44. More Info ECMAScript site: ✦ http://ecmascript.org/ ECMAScript 4 White Paper Overview: ✦ http://www.ecmascript.org/es4/spec/overview.pdf Blogging: ✦ http://ejohn.org/