SlideShare a Scribd company logo
1 of 27
Download to read offline
Yet	
  another	
  Javascript	
  transpiler

                                      Iván	
  –	
  DrSlump	
  –	
  Montes
                       @drslump	
  -­‐	
  www.pollinimini.net	
  -­‐	
  github.com/drslump




Tuesday, November 27, 12
Javascript	
  as	
  Virtual	
  Machine




Tuesday, November 27, 12
JS is the x86 of the web.

          The point is JS is about as low as we
          can go. But it also has higher-level
          facilities.
                                         Brendan	
  Eich
                                        JavaScript’s	
  creator



Tuesday, November 27, 12
JavaScript is the VM of the web. We
          had always thought that Java’s JVM
          would be the VM of the web, but it turns
          out that it’s JavaScript.


                                       Douglas	
  Crockford
                                          JavaScript	
  evangelist



Tuesday, November 27, 12
The JavaScript we've got now is the
          assembly language of the client-side.
          We can't easily change it, but we have
          to start building better tools on top of
          it.

                                                 Jonnycat
                                          Y	
  Combinator	
  user



Tuesday, November 27, 12
A	
  Popular	
  Trend




Tuesday, November 27, 12
grade = (student) ->
       if student.excellentWork
         "A+"
       else if student.okayStuff
         if student.triedHard then "B" else "B-"
       else
         "C"

     eldest = if 24 > 21 then "Liz" else "Ike"




     Open	
  source	
  project	
  with	
  a	
  huge	
  community
     Syntax	
  sugar,	
  more	
  a	
  pre-­‐processor	
  than	
  a	
  
     compiler
     Focused	
  on	
  having	
  a	
  very	
  concise	
  syntax

Tuesday, November 27, 12
/**
      * A shape.
      * @interface
      */
     function Shape() {};
     Shape.prototype.draw = function() {};

     /**
      * @constructor
      * @implements {Shape}
      */
     function Square() {};
     Square.prototype.draw = function() {
       ...
     };



     Backed	
  by	
  Google
     Annotated	
  Javascript	
  code
     More	
  a	
  staOc	
  analysis	
  tool	
  than	
  a	
  compiler


Tuesday, November 27, 12
interface Person {
          firstname: string;
          lastname: string;
      }

      function greeter(person : Person) {
          return "Hello, " + person.firstname + " " + person.lastname;
      }

      var user = {firstname: "Jane", lastname: "User"};

      document.body.innerHTML = greeter(user);




     Backed	
  by	
  MicrosoP
     Type	
  extensions	
  to	
  JavaScript	
  syntax
     Focused	
  on	
  being	
  IDE	
  friendly


Tuesday, November 27, 12
Why	
  so	
  many?
     • Javascript	
  syntax	
  is	
  geRng	
  dated	
  (Harmony	
  in	
  the	
  works	
  
       to	
  somehow	
  remedy	
  that)
     • Browser	
  war	
  has	
  focused	
  on	
  Javascript	
  engines,	
  huge	
  
       performance	
  boost	
  in	
  latest	
  years.
     • Programmers	
  with	
  many	
  different	
  backgrounds	
  using	
  
       Javascript	
  to	
  develop/deploy	
  complex	
  products.
     • Much	
  improved	
  debugging	
  tools	
  (Firebug,	
  SourceMaps,	
  
       OpOmizers,	
  …)
     • User	
  friendly	
  write-­‐compile-­‐test	
  workflows	
  	
  




Tuesday, November 27, 12
Won’t	
  Harmony	
  save	
  JavaScript?
     • The	
  standard	
  is	
  finally	
  coming	
  along	
  but	
  not	
  expected	
  to	
  
       be	
  finished	
  unOl	
  mid	
  2013.	
  Browser	
  vendors	
  are	
  not	
  too	
  
       far	
  from	
  having	
  a	
  working	
  implementaOon	
  though.
     • The	
  browser	
  market	
  is	
  hugely	
  fragmented,	
  mobile	
  devices	
  
       will	
  probably	
  held	
  back	
  early	
  adopOon	
  this	
  Ome,	
  although	
  
       we	
  will	
  conOnue	
  to	
  blame	
  MicrosoP	
  :-­‐)
     • Harmony	
  is	
  being	
  driven	
  to	
  be	
  highly	
  performant	
  on	
  
       current	
  engines	
  not	
  that	
  much	
  on	
  improving	
  developers	
  
       performance.
     • Harmony	
  will	
  be	
  a	
  good	
  step	
  forward	
  but	
  it	
  won’t	
  render	
  
       fuOle	
  the	
  JavaScript	
  as	
  Virtual	
  Machine	
  approach.



Tuesday, November 27, 12
The	
  Boo	
  Language




Tuesday, November 27, 12
Boo is an object oriented statically
          typed programming language ... with a
          python inspired syntax and a special
          focus on language and compiler
          extensibility.

                                  Rodrigo	
  B.	
  De	
  Oliveira
                                                   Boo’s	
  creator



Tuesday, November 27, 12
import System


           class Person:
                 public name as string
                 public age as int


                 def constructor(name as string):
                       .name = name
                       age = 0


           def birthday(p as Person):
                 p.age += 1


           # Create an instance
           me = Person('DrSlump', age: 32)
           birthday(me)
           print "$(me.name) celebrated his $(me.age) birthday"

Tuesday, November 27, 12
Readable	
  and	
  expressive	
  syntax
       Python	
  inspired
       DSL	
  oriented
    StaOcally	
  typed
       Type	
  inference
       Duck	
  typing
    Extensible
       Macros	
  and	
  Meta	
  methods	
  (AST	
  manipulaOon)
       Open	
  compiler	
  design	
  (Pipelines)


Tuesday, November 27, 12
Language	
  Features
        .Net	
  Type	
  System	
  (classes,	
  value	
  types,	
  interfaces,	
  ...)
        Slicing	
  syntax,	
  Variadic	
  arguments,	
  IniOalizers
        FuncOons	
  are	
  first	
  class	
  ciOzens
        Closures
        Events,	
  Generators,	
  Expression	
  modifiers
        Method	
  and	
  Operators	
  Overloading




Tuesday, November 27, 12
Extensibility	
  and	
  Meta	
  programming
        SyntacOc	
  Macros	
  and	
  Afributes
        Meta	
  methods	
  (macros	
  aPer	
  type	
  resoluOon)
        Pafern	
  Matching
        Custom	
  pipelines
        Compiler	
  as	
  a	
  service




Tuesday, November 27, 12
BooJs
                           boo·jay·es   /bʊ ˈdʒeɪ ɛs/




Tuesday, November 27, 12
Why	
  did	
  you	
  do	
  it?
        More	
  bang	
  for	
  the	
  buck
                 If	
  we	
  are	
  going	
  to	
  require	
  a	
  compilaOon	
  workflow,	
  lets	
  
                 have	
  a	
  really	
  powerful	
  compiler,	
  not	
  just	
  syntacOc	
  sugar.

        An	
  almost	
  perfect	
  type	
  system
                 A	
  staOcally	
  typed	
  language	
  with	
  the	
  look	
  and	
  feel	
  of	
  a	
  
                 scripOng	
  language	
  is	
  a	
  great	
  combinaOon,	
  specially	
  for	
  
                 medium	
  to	
  large	
  code	
  bases.	
  It’s	
  just	
  one	
  small	
  step	
  short	
  
                 from	
  latent	
  typing,	
  which	
  I	
  hope	
  to	
  support	
  in	
  the	
  future.

        It	
  is	
  FUN!
                 Programming	
  is	
  fun	
  ergo	
  programming	
  compilers	
  is	
  twice	
  
                 as	
  fun!


Tuesday, November 27, 12
Comparison	
  with	
  Javascript
                                                                Boo                         JavaScript
                      First-­‐class	
  funcEons                   	
  ✓                             	
  ✓
                     FuncEon	
  expressions                       	
  ✓                             	
  ✓
                                     Closures                     	
  ✓                             	
  ✓
                                        Scope     Lexical	
  (funcOon	
  and	
  types)    Lexical	
  (funcOon)
                                 Type	
  system   StaOc	
  and	
  Dynamic	
  (strong)     Dynamic	
  (weak)
                           Variadic	
  funcEons                   	
  ✓                  	
  ✓	
  (via	
  arguments)
                                  Inheritance           Class/Type	
  based                   Prototypal
                                  Generators                      	
  ✓                              ✘
                     List	
  comprehensions                       	
  ✓                              ✘
                                     Iterators                    	
  ✓                              ✘
                                   ProperEes                      	
  ✓                              ✘
                               Destructuring                      	
  ✓                              ✘
                     Method	
  overloading                        	
  ✓                              ✘
                    Operator	
  overloading                       	
  ✓                              ✘
                                      Macros                      	
  ✓                              ✘
                           PaLern	
  Matching                     	
  ✓                              ✘



Tuesday, November 27, 12
ImplementaOon
        Leverages	
  Boo’s	
  open	
  compiler	
  design
        Implemented	
  using	
  the	
  Boo	
  language
        Runs	
  on	
  .Net	
  4.0	
  and	
  Mono	
  2.1.x
        Over	
  700	
  unit	
  tests,	
  automated	
  with	
  Travis-­‐CI
        Generates	
  a	
  Mozilla	
  AST,	
  prefy	
  printed	
  to	
  JS	
  1.5
        SourceMaps	
  support	
  
        JS	
  type	
  system	
  and	
  runOme	
  (no	
  .NET	
  emulaOon!)
        Lightweight	
  runOme	
  library	
  (≈4kb	
  gzipped)


Tuesday, November 27, 12
ApplicaOon	
  structure
        Each	
  file	
  is	
  a	
  Module
        Each	
  Module	
  has	
  a	
  single	
  Namespace
        Modules	
  are	
  organized	
  in	
  Assemblies
        Only	
  one	
  of	
  the	
  modules	
  can	
  be	
  the	
  entry	
  point
        External	
  Namespaces	
  and	
  Types	
  can	
  be	
  imported
        Each	
  assembly	
  generates	
  an	
  output	
  Javascript	
  file
        An	
  AMD	
  style	
  loader	
  is	
  used	
  to	
  resolve	
  dependencies




Tuesday, November 27, 12
Using	
  exisOng	
  JavaScript	
  code
        Macros	
  and	
  afributes	
  to	
  model	
  external	
  Javascript
        Standard	
  APIs	
  like	
  the	
  DOM/jQuery	
  are	
  provided
        Support	
  for	
  prototypal	
  and	
  Module	
  Pafern	
  styles
        Extern	
  type	
  definiOons	
  do	
  not	
  generate	
  any	
  code
        `backOck	
  quoted	
  code`	
  is	
  embedded	
  unmodified
        Global	
  macro	
  to	
  access	
  exisOng	
  symbols
        Duck	
  typing	
  allows	
  to	
  use	
  pracOcally	
  everything!




Tuesday, November 27, 12
Code	
  example




Tuesday, November 27, 12
Tuesday, November 27, 12
The limits of my language are
          the limits of my world.


                              Ludwig	
  Wifgenstein
                                Philosopher	
  (1889-­‐1951)



Tuesday, November 27, 12
Related	
  material
        BooJs	
  project	
  page
        Boo	
  website




Tuesday, November 27, 12

More Related Content

Similar to DEVCON1 - BooJs

Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Espen Brækken
 
Non Relational Databases
Non Relational DatabasesNon Relational Databases
Non Relational DatabasesChris Baglieri
 
Your java script library
Your java script libraryYour java script library
Your java script libraryjasfog
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Guillaume Laforge
 
Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...elliando dias
 
What have the annotations done to us?
What have the annotations done to us?What have the annotations done to us?
What have the annotations done to us?Adam Warski
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02sagaroceanic11
 
Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Michał Konarski
 
JavaScript nicht nur für Programmierer: Einblicke in die weltweit am meisten ...
JavaScript nicht nur für Programmierer: Einblicke in die weltweit am meisten ...JavaScript nicht nur für Programmierer: Einblicke in die weltweit am meisten ...
JavaScript nicht nur für Programmierer: Einblicke in die weltweit am meisten ...Peter Hecker
 
Ruby Metaprogramming - OSCON 2008
Ruby Metaprogramming - OSCON 2008Ruby Metaprogramming - OSCON 2008
Ruby Metaprogramming - OSCON 2008Brian Sam-Bodden
 
Clojure Lightning Talk
Clojure Lightning TalkClojure Lightning Talk
Clojure Lightning TalkGiltTech
 

Similar to DEVCON1 - BooJs (20)

Developing Distributed Semantic Systems
Developing Distributed Semantic SystemsDeveloping Distributed Semantic Systems
Developing Distributed Semantic Systems
 
Object
ObjectObject
Object
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
DSLs in JavaScript
DSLs in JavaScriptDSLs in JavaScript
DSLs in JavaScript
 
Reactjs
ReactjsReactjs
Reactjs
 
Dart
DartDart
Dart
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex
 
Non Relational Databases
Non Relational DatabasesNon Relational Databases
Non Relational Databases
 
Your java script library
Your java script libraryYour java script library
Your java script library
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
 
Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...
 
Ruby Metaprogramming 08
Ruby Metaprogramming 08Ruby Metaprogramming 08
Ruby Metaprogramming 08
 
What have the annotations done to us?
What have the annotations done to us?What have the annotations done to us?
What have the annotations done to us?
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02
 
Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?
 
JavaScript nicht nur für Programmierer: Einblicke in die weltweit am meisten ...
JavaScript nicht nur für Programmierer: Einblicke in die weltweit am meisten ...JavaScript nicht nur für Programmierer: Einblicke in die weltweit am meisten ...
JavaScript nicht nur für Programmierer: Einblicke in die weltweit am meisten ...
 
Ruby Metaprogramming - OSCON 2008
Ruby Metaprogramming - OSCON 2008Ruby Metaprogramming - OSCON 2008
Ruby Metaprogramming - OSCON 2008
 
Clojure Lightning Talk
Clojure Lightning TalkClojure Lightning Talk
Clojure Lightning Talk
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 

Recently uploaded

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
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
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
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
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
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
 
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
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"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
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
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
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
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
 
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)
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
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
 
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
 
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
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"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
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

DEVCON1 - BooJs

  • 1. Yet  another  Javascript  transpiler Iván  –  DrSlump  –  Montes @drslump  -­‐  www.pollinimini.net  -­‐  github.com/drslump Tuesday, November 27, 12
  • 2. Javascript  as  Virtual  Machine Tuesday, November 27, 12
  • 3. JS is the x86 of the web. The point is JS is about as low as we can go. But it also has higher-level facilities. Brendan  Eich JavaScript’s  creator Tuesday, November 27, 12
  • 4. JavaScript is the VM of the web. We had always thought that Java’s JVM would be the VM of the web, but it turns out that it’s JavaScript. Douglas  Crockford JavaScript  evangelist Tuesday, November 27, 12
  • 5. The JavaScript we've got now is the assembly language of the client-side. We can't easily change it, but we have to start building better tools on top of it. Jonnycat Y  Combinator  user Tuesday, November 27, 12
  • 7. grade = (student) -> if student.excellentWork "A+" else if student.okayStuff if student.triedHard then "B" else "B-" else "C" eldest = if 24 > 21 then "Liz" else "Ike" Open  source  project  with  a  huge  community Syntax  sugar,  more  a  pre-­‐processor  than  a   compiler Focused  on  having  a  very  concise  syntax Tuesday, November 27, 12
  • 8. /**  * A shape.  * @interface  */ function Shape() {}; Shape.prototype.draw = function() {}; /**  * @constructor  * @implements {Shape}  */ function Square() {}; Square.prototype.draw = function() {   ... }; Backed  by  Google Annotated  Javascript  code More  a  staOc  analysis  tool  than  a  compiler Tuesday, November 27, 12
  • 9. interface Person { firstname: string; lastname: string; } function greeter(person : Person) { return "Hello, " + person.firstname + " " + person.lastname; } var user = {firstname: "Jane", lastname: "User"}; document.body.innerHTML = greeter(user); Backed  by  MicrosoP Type  extensions  to  JavaScript  syntax Focused  on  being  IDE  friendly Tuesday, November 27, 12
  • 10. Why  so  many? • Javascript  syntax  is  geRng  dated  (Harmony  in  the  works   to  somehow  remedy  that) • Browser  war  has  focused  on  Javascript  engines,  huge   performance  boost  in  latest  years. • Programmers  with  many  different  backgrounds  using   Javascript  to  develop/deploy  complex  products. • Much  improved  debugging  tools  (Firebug,  SourceMaps,   OpOmizers,  …) • User  friendly  write-­‐compile-­‐test  workflows     Tuesday, November 27, 12
  • 11. Won’t  Harmony  save  JavaScript? • The  standard  is  finally  coming  along  but  not  expected  to   be  finished  unOl  mid  2013.  Browser  vendors  are  not  too   far  from  having  a  working  implementaOon  though. • The  browser  market  is  hugely  fragmented,  mobile  devices   will  probably  held  back  early  adopOon  this  Ome,  although   we  will  conOnue  to  blame  MicrosoP  :-­‐) • Harmony  is  being  driven  to  be  highly  performant  on   current  engines  not  that  much  on  improving  developers   performance. • Harmony  will  be  a  good  step  forward  but  it  won’t  render   fuOle  the  JavaScript  as  Virtual  Machine  approach. Tuesday, November 27, 12
  • 12. The  Boo  Language Tuesday, November 27, 12
  • 13. Boo is an object oriented statically typed programming language ... with a python inspired syntax and a special focus on language and compiler extensibility. Rodrigo  B.  De  Oliveira Boo’s  creator Tuesday, November 27, 12
  • 14. import System class Person: public name as string public age as int def constructor(name as string): .name = name age = 0 def birthday(p as Person): p.age += 1 # Create an instance me = Person('DrSlump', age: 32) birthday(me) print "$(me.name) celebrated his $(me.age) birthday" Tuesday, November 27, 12
  • 15. Readable  and  expressive  syntax Python  inspired DSL  oriented StaOcally  typed Type  inference Duck  typing Extensible Macros  and  Meta  methods  (AST  manipulaOon) Open  compiler  design  (Pipelines) Tuesday, November 27, 12
  • 16. Language  Features .Net  Type  System  (classes,  value  types,  interfaces,  ...) Slicing  syntax,  Variadic  arguments,  IniOalizers FuncOons  are  first  class  ciOzens Closures Events,  Generators,  Expression  modifiers Method  and  Operators  Overloading Tuesday, November 27, 12
  • 17. Extensibility  and  Meta  programming SyntacOc  Macros  and  Afributes Meta  methods  (macros  aPer  type  resoluOon) Pafern  Matching Custom  pipelines Compiler  as  a  service Tuesday, November 27, 12
  • 18. BooJs boo·jay·es /bʊ ˈdʒeɪ ɛs/ Tuesday, November 27, 12
  • 19. Why  did  you  do  it? More  bang  for  the  buck If  we  are  going  to  require  a  compilaOon  workflow,  lets   have  a  really  powerful  compiler,  not  just  syntacOc  sugar. An  almost  perfect  type  system A  staOcally  typed  language  with  the  look  and  feel  of  a   scripOng  language  is  a  great  combinaOon,  specially  for   medium  to  large  code  bases.  It’s  just  one  small  step  short   from  latent  typing,  which  I  hope  to  support  in  the  future. It  is  FUN! Programming  is  fun  ergo  programming  compilers  is  twice   as  fun! Tuesday, November 27, 12
  • 20. Comparison  with  Javascript Boo JavaScript First-­‐class  funcEons  ✓  ✓ FuncEon  expressions  ✓  ✓ Closures  ✓  ✓ Scope Lexical  (funcOon  and  types) Lexical  (funcOon) Type  system StaOc  and  Dynamic  (strong) Dynamic  (weak) Variadic  funcEons  ✓  ✓  (via  arguments) Inheritance Class/Type  based Prototypal Generators  ✓ ✘ List  comprehensions  ✓ ✘ Iterators  ✓ ✘ ProperEes  ✓ ✘ Destructuring  ✓ ✘ Method  overloading  ✓ ✘ Operator  overloading  ✓ ✘ Macros  ✓ ✘ PaLern  Matching  ✓ ✘ Tuesday, November 27, 12
  • 21. ImplementaOon Leverages  Boo’s  open  compiler  design Implemented  using  the  Boo  language Runs  on  .Net  4.0  and  Mono  2.1.x Over  700  unit  tests,  automated  with  Travis-­‐CI Generates  a  Mozilla  AST,  prefy  printed  to  JS  1.5 SourceMaps  support   JS  type  system  and  runOme  (no  .NET  emulaOon!) Lightweight  runOme  library  (≈4kb  gzipped) Tuesday, November 27, 12
  • 22. ApplicaOon  structure Each  file  is  a  Module Each  Module  has  a  single  Namespace Modules  are  organized  in  Assemblies Only  one  of  the  modules  can  be  the  entry  point External  Namespaces  and  Types  can  be  imported Each  assembly  generates  an  output  Javascript  file An  AMD  style  loader  is  used  to  resolve  dependencies Tuesday, November 27, 12
  • 23. Using  exisOng  JavaScript  code Macros  and  afributes  to  model  external  Javascript Standard  APIs  like  the  DOM/jQuery  are  provided Support  for  prototypal  and  Module  Pafern  styles Extern  type  definiOons  do  not  generate  any  code `backOck  quoted  code`  is  embedded  unmodified Global  macro  to  access  exisOng  symbols Duck  typing  allows  to  use  pracOcally  everything! Tuesday, November 27, 12
  • 26. The limits of my language are the limits of my world. Ludwig  Wifgenstein Philosopher  (1889-­‐1951) Tuesday, November 27, 12
  • 27. Related  material BooJs  project  page Boo  website Tuesday, November 27, 12