SlideShare a Scribd company logo
MacRuby
      What is it?
and why should you care?


 Presented by: Joshua Ballanco
A bit about me...
•   Using Ruby since 2004 (didn’t discover Rails
    until 2006)
•   Worked for Apple 2006-2010 (Fifth Ave store
    & HQ in Cupertino)
•   Now at Patch (and just completed a migration
    to Ruby 1.9)
•   MacRuby Core Team member
A bit about me...
•   Using Ruby since 2004 (didn’t discover Rails
    until 2006)
•   Worked for Apple 2006-2010 (Fifth Ave store
    & HQ in Cupertino)
•   Now at Patch (and just completed a migration
    to Ruby 1.9)
•   MacRuby Core Team member
•   As of yesterday:
            Dr. Joshua Ballanco, Ph.D.
Overview
•   Practical MacRuby
    •   How is MacRuby different?

    •   Working with Cocoa

    •   Compiled Ruby!

    •   Make your millions on the App store

•   Nuts & Bolts
    •   GC

    •   Regular Expression Engine

    •   Hash method syntax

    •   LLVM & other Hacking

•   GCD
What is MacRuby?
What is MacRuby?
• http://www.macruby.org
• http://www.macruby.org/files/
• http://www.macruby.org/files/nightlies/
• Available from RVM (but not
  recommended)
• Source now located at GitHub!
  https://github.com/MacRuby/MacRuby
What is MacRuby?
• Compiling MacRuby:
  •   Need LLVM (see the README; brew install llvm)

  •   rake ; sudo rake install

• Bugs – https://www.macruby.org/trac/
  report
• MacRuby-devel mailing list
• @macruby, #macruby
No Really, What is
   MacRuby?
No Really, What is
       MacRuby?
A language with:
•   Dynamic typing
•   Objects everywhere
•   Method calls via sending messages
•   Automatic generation of accessors
•   Methods can be added to classes at runtime
•   Garbage Collection
•   Closures
No Really, What is
       MacRuby?
A language with:
•   Dynamic typing
•   Objects everywhere
•   Method calls via sending messages
•   Automatic generation of accessors
•   Methods can be added to classes at runtime
•   Garbage Collection
•   Closures
               ...called Objective-C
Ruby Syntax




                             Parser
                            MRI’s parse.y




                           Compiler
                      RoxorCompiler <C++>




     VM (sans GVL)
                                            LLVM (with JIT)
RoxorVM & RoxorCore <C++>




                     Objective-C Runtime
Integrating with Cocoa
• Bridge Support (please download preview 3
  from the “files” page)
• Reads header files and generates XML
  descriptions of types and method
  signatures
• MacRuby uses BS files to construct calls
  and access constants and types
A Ruby You Can
            Compile
• macrubyc
• Advantages:
 •   Faster startup, faster runtime (in most cases)

 •   Don’t distribute the source!

• Disadvantages:
 •   ?

 •   ...some bugs
A Ruby You Can
         Compile
• -c → Compile and assemble; good for
  multistage builds

• -C → Compile, assemble, and link creating
  an *.rbo
• Can also create stand-alone executables
  and entire “*.framework”s (experimental)
I wanna be an App
       store billionaire...
• Downloads contain Xcode templates
  (mostly work in Xcode 4)
• Integration with Interface Builder
• macruby_deploy
  •   Includes BS files

  •   Unpacks Gems

  •   Compiles source
I wanna be an App
 store billionaire...
I wanna be an App
 store billionaire...
  QuickAlarm

            Briquette

    Timey

            Zero2Nine
MacRuby Nuts & Bolts
Garbage Collector:
        libauto
• Yet another open source project from
  Apple
• The GC for Obj-C
• Based on write barriers
• scanning, conservative, generational, multi-
  threaded garbage collector...
• ...unfortunately...slow
Garbage Collector:
the Next Generation(?)
• Ruby does A LOT of allocations
• Nice to not have to stop the world, but...
• Write barriers are slow
• Maybe ref counting?
• Maybe MRI’s collector isn’t so bad after all...
RegExps:
               ICU
• Oniguruma is not (real thread) thread safe
• ICU is
 • thread safe
 • Unicode compatible
 • not as crazy feature-full as Oniguruma
• There are some bugs...but honestly, stop
  doing that with RegExps!!!
Hash method syntax

• Ruby 1.9’s hash syntax with Symbol keys:
   a = { foo: 1, bar: 2, baz: “Hello, world” }

• ...looks a bit like:
   [@”Hello, world” rangeOfString:@”Ello” options:
   NSCaseInsensitiveSearch]

• Let’s go with that!
Hash method syntax
• MacRuby turns method calls with hash
  arguments into SEL
• MacRuby turns method definitions with
  hash lists into SEL
• MacRuby can call Objective-C
• Objective-C can call MacRuby, but when
  possible you should use:
  [[MacRuby sharedRuntime] performRubySelector]
LLVM, JIT, and Hacking

• LLVM provides optimizations
• LLVM provides JIT utilities (kinda slow)
• MacRuby can emit LLVM...
  VM_DUMP_IR=1 macruby -e "def foo; puts 'hello'; end;
  foo"

• Find other neat tricks in HACKING.rdoc
GCD & The Future
GCD
• MacRuby can tap directly into GCD
• Dispatch module:
 • Dispatch::Queue
 • Dispatch::Group
 • Dispatch::Source
• Dispatch Gem too!
GCD
• Dispatch is a powerful tool for concurrent
  programming
• Example: ControlTower
 • MacRuby Rack-based server
 • Uses GCD to handle requets
 • Accomplishes in 1 line what takes Thin/
    EventMachine > 6000 lines of C++ &
    Ruby
GCD
GCD

• Can we make GCD work in MRI?
• JRuby thinks they can make it work...
  https://github.com/headius/jcd
• GCD is Multithreaded Programming, Ruby
  Style
Thank you!

http://ofps.oreilly.com/titles/9781449380373/

More Related Content

What's hot

XRuby_Overview_20070831
XRuby_Overview_20070831XRuby_Overview_20070831
XRuby_Overview_20070831
dreamhead
 
Ruby projects of interest for DevOps
Ruby projects of interest for DevOpsRuby projects of interest for DevOps
Ruby projects of interest for DevOps
Ricardo Sanchez
 
Distributing OSGi
Distributing OSGiDistributing OSGi
Distributing OSGi
Bram de Kruijff
 
Rake: Not Your Father's Build Tool
Rake: Not Your Father's Build ToolRake: Not Your Father's Build Tool
Rake: Not Your Father's Build Tool
filmprog
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02
sagaroceanic11
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and Ruby
Evgeny Rahman
 
JRuby in the enterprise
JRuby in the enterpriseJRuby in the enterprise
JRuby in the enterprise
Jerry Gulla
 
Dmytro Kochergin Angular 2 and New Java Script Technologies
Dmytro Kochergin Angular 2 and New Java Script TechnologiesDmytro Kochergin Angular 2 and New Java Script Technologies
Dmytro Kochergin Angular 2 and New Java Script Technologies
LogeekNightUkraine
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
elliando dias
 
RubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on RailsRubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on Rails
elliando dias
 
Why JRuby?
Why JRuby?Why JRuby?
Why JRuby?
Fiona Tay
 
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil BartlettHow to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
mfrancis
 
Ruby Beyond Rails
Ruby Beyond RailsRuby Beyond Rails
Ruby Beyond Rails
Gaveen Prabhasara
 
JRuby Basics
JRuby BasicsJRuby Basics
JRuby Basics
elliando dias
 
Java virtual machine 101
Java virtual machine 101Java virtual machine 101
Java virtual machine 101
Sarath Soman
 
Perl On The JVM (London.pm Talk 2009-04)
Perl On The JVM (London.pm Talk 2009-04)Perl On The JVM (London.pm Talk 2009-04)
Perl On The JVM (London.pm Talk 2009-04)
Ben Evans
 
Optimizing Java Notes
Optimizing Java NotesOptimizing Java Notes
Optimizing Java Notes
Adam Feldscher
 
Java Closures
Java ClosuresJava Closures
Java Closures
Ben Evans
 
Ruby Presentation - Beamer
Ruby Presentation - BeamerRuby Presentation - Beamer
Ruby Presentation - Beamer
Christopher Giroir
 

What's hot (19)

XRuby_Overview_20070831
XRuby_Overview_20070831XRuby_Overview_20070831
XRuby_Overview_20070831
 
Ruby projects of interest for DevOps
Ruby projects of interest for DevOpsRuby projects of interest for DevOps
Ruby projects of interest for DevOps
 
Distributing OSGi
Distributing OSGiDistributing OSGi
Distributing OSGi
 
Rake: Not Your Father's Build Tool
Rake: Not Your Father's Build ToolRake: Not Your Father's Build Tool
Rake: Not Your Father's Build Tool
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and Ruby
 
JRuby in the enterprise
JRuby in the enterpriseJRuby in the enterprise
JRuby in the enterprise
 
Dmytro Kochergin Angular 2 and New Java Script Technologies
Dmytro Kochergin Angular 2 and New Java Script TechnologiesDmytro Kochergin Angular 2 and New Java Script Technologies
Dmytro Kochergin Angular 2 and New Java Script Technologies
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
 
RubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on RailsRubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on Rails
 
Why JRuby?
Why JRuby?Why JRuby?
Why JRuby?
 
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil BartlettHow to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
 
Ruby Beyond Rails
Ruby Beyond RailsRuby Beyond Rails
Ruby Beyond Rails
 
JRuby Basics
JRuby BasicsJRuby Basics
JRuby Basics
 
Java virtual machine 101
Java virtual machine 101Java virtual machine 101
Java virtual machine 101
 
Perl On The JVM (London.pm Talk 2009-04)
Perl On The JVM (London.pm Talk 2009-04)Perl On The JVM (London.pm Talk 2009-04)
Perl On The JVM (London.pm Talk 2009-04)
 
Optimizing Java Notes
Optimizing Java NotesOptimizing Java Notes
Optimizing Java Notes
 
Java Closures
Java ClosuresJava Closures
Java Closures
 
Ruby Presentation - Beamer
Ruby Presentation - BeamerRuby Presentation - Beamer
Ruby Presentation - Beamer
 

Viewers also liked

There and Back Again
There and Back AgainThere and Back Again
There and Back Again
Joshua Ballanco
 
MacRuby for Fun and Profit
MacRuby for Fun and ProfitMacRuby for Fun and Profit
MacRuby for Fun and Profit
Joshua Ballanco
 
A Tale of Two Rubies
A Tale of Two RubiesA Tale of Two Rubies
A Tale of Two Rubies
Joshua Ballanco
 
Debugging RubyMotion
Debugging RubyMotionDebugging RubyMotion
Debugging RubyMotion
Joshua Ballanco
 
RubyMotion: Under the Hood
RubyMotion: Under the HoodRubyMotion: Under the Hood
RubyMotion: Under the Hood
Joshua Ballanco
 
Getting Your Ruby EGOT
Getting Your Ruby EGOTGetting Your Ruby EGOT
Getting Your Ruby EGOT
Joshua Ballanco
 
Keeping ruby reasonable
Keeping ruby reasonableKeeping ruby reasonable
Keeping ruby reasonable
Joshua Ballanco
 
5分でできる U S T配信(保存用)
5分でできる U S T配信(保存用)5分でできる U S T配信(保存用)
5分でできる U S T配信(保存用)Hiroaki Kobayashi
 
Ruby memory model
Ruby memory modelRuby memory model
Ruby memory model
Hari Krishnan‎
 

Viewers also liked (9)

There and Back Again
There and Back AgainThere and Back Again
There and Back Again
 
MacRuby for Fun and Profit
MacRuby for Fun and ProfitMacRuby for Fun and Profit
MacRuby for Fun and Profit
 
A Tale of Two Rubies
A Tale of Two RubiesA Tale of Two Rubies
A Tale of Two Rubies
 
Debugging RubyMotion
Debugging RubyMotionDebugging RubyMotion
Debugging RubyMotion
 
RubyMotion: Under the Hood
RubyMotion: Under the HoodRubyMotion: Under the Hood
RubyMotion: Under the Hood
 
Getting Your Ruby EGOT
Getting Your Ruby EGOTGetting Your Ruby EGOT
Getting Your Ruby EGOT
 
Keeping ruby reasonable
Keeping ruby reasonableKeeping ruby reasonable
Keeping ruby reasonable
 
5分でできる U S T配信(保存用)
5分でできる U S T配信(保存用)5分でできる U S T配信(保存用)
5分でできる U S T配信(保存用)
 
Ruby memory model
Ruby memory modelRuby memory model
Ruby memory model
 

Similar to MacRuby: What is it? and why should you care?

ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
tutorialsruby
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin Programming
Atlassian
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
Barry Jones
 
Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016
Charles Nutter
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyists
bobmcwhirter
 
Ruby on the JVM
Ruby on the JVMRuby on the JVM
Ruby on the JVM
Kresten Krab Thorup
 
GUI Programming with MacRuby
GUI Programming with MacRubyGUI Programming with MacRuby
GUI Programming with MacRuby
Erik Berlin
 
Concurrency in ruby
Concurrency in rubyConcurrency in ruby
Concurrency in ruby
Marco Borromeo
 
Mac ruby deployment
Mac ruby deploymentMac ruby deployment
Mac ruby deployment
Thilo Utke
 
Javascript Best Practices and Intro to Titanium
Javascript Best Practices and Intro to TitaniumJavascript Best Practices and Intro to Titanium
Javascript Best Practices and Intro to Titanium
Techday7
 
RubyならMacでしょう
RubyならMacでしょうRubyならMacでしょう
RubyならMacでしょう
vincentisambart
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)
Thomas Lundström
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
Troy Miles
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Charlie Gracie
 
Polyglot Grails
Polyglot GrailsPolyglot Grails
Polyglot Grails
Marcin Gryszko
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
Jung Kim
 
MacRuby For Ruby Developers
MacRuby For Ruby DevelopersMacRuby For Ruby Developers
MacRuby For Ruby Developers
Renzo Borgatti
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Nilesh Panchal
 
Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門
Wen-Tien Chang
 
Go: What's Different ?
Go: What's Different ?Go: What's Different ?
Go: What's Different ?
Tarun Vashisth
 

Similar to MacRuby: What is it? and why should you care? (20)

ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin Programming
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyists
 
Ruby on the JVM
Ruby on the JVMRuby on the JVM
Ruby on the JVM
 
GUI Programming with MacRuby
GUI Programming with MacRubyGUI Programming with MacRuby
GUI Programming with MacRuby
 
Concurrency in ruby
Concurrency in rubyConcurrency in ruby
Concurrency in ruby
 
Mac ruby deployment
Mac ruby deploymentMac ruby deployment
Mac ruby deployment
 
Javascript Best Practices and Intro to Titanium
Javascript Best Practices and Intro to TitaniumJavascript Best Practices and Intro to Titanium
Javascript Best Practices and Intro to Titanium
 
RubyならMacでしょう
RubyならMacでしょうRubyならMacでしょう
RubyならMacでしょう
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
 
Polyglot Grails
Polyglot GrailsPolyglot Grails
Polyglot Grails
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
 
MacRuby For Ruby Developers
MacRuby For Ruby DevelopersMacRuby For Ruby Developers
MacRuby For Ruby Developers
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
 
Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門
 
Go: What's Different ?
Go: What's Different ?Go: What's Different ?
Go: What's Different ?
 

Recently uploaded

Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
UiPathCommunity
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
christinelarrosa
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
ScyllaDB
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
Sunil Jagani
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
HarpalGohil4
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
Fwdays
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
Tobias Schneck
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
christinelarrosa
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
ScyllaDB
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 

Recently uploaded (20)

Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 

MacRuby: What is it? and why should you care?

  • 1. MacRuby What is it? and why should you care? Presented by: Joshua Ballanco
  • 2. A bit about me... • Using Ruby since 2004 (didn’t discover Rails until 2006) • Worked for Apple 2006-2010 (Fifth Ave store & HQ in Cupertino) • Now at Patch (and just completed a migration to Ruby 1.9) • MacRuby Core Team member
  • 3. A bit about me... • Using Ruby since 2004 (didn’t discover Rails until 2006) • Worked for Apple 2006-2010 (Fifth Ave store & HQ in Cupertino) • Now at Patch (and just completed a migration to Ruby 1.9) • MacRuby Core Team member • As of yesterday: Dr. Joshua Ballanco, Ph.D.
  • 4. Overview • Practical MacRuby • How is MacRuby different? • Working with Cocoa • Compiled Ruby! • Make your millions on the App store • Nuts & Bolts • GC • Regular Expression Engine • Hash method syntax • LLVM & other Hacking • GCD
  • 6. What is MacRuby? • http://www.macruby.org • http://www.macruby.org/files/ • http://www.macruby.org/files/nightlies/ • Available from RVM (but not recommended) • Source now located at GitHub! https://github.com/MacRuby/MacRuby
  • 7. What is MacRuby? • Compiling MacRuby: • Need LLVM (see the README; brew install llvm) • rake ; sudo rake install • Bugs – https://www.macruby.org/trac/ report • MacRuby-devel mailing list • @macruby, #macruby
  • 8. No Really, What is MacRuby?
  • 9. No Really, What is MacRuby? A language with: • Dynamic typing • Objects everywhere • Method calls via sending messages • Automatic generation of accessors • Methods can be added to classes at runtime • Garbage Collection • Closures
  • 10. No Really, What is MacRuby? A language with: • Dynamic typing • Objects everywhere • Method calls via sending messages • Automatic generation of accessors • Methods can be added to classes at runtime • Garbage Collection • Closures ...called Objective-C
  • 11. Ruby Syntax Parser MRI’s parse.y Compiler RoxorCompiler <C++> VM (sans GVL) LLVM (with JIT) RoxorVM & RoxorCore <C++> Objective-C Runtime
  • 12. Integrating with Cocoa • Bridge Support (please download preview 3 from the “files” page) • Reads header files and generates XML descriptions of types and method signatures • MacRuby uses BS files to construct calls and access constants and types
  • 13. A Ruby You Can Compile • macrubyc • Advantages: • Faster startup, faster runtime (in most cases) • Don’t distribute the source! • Disadvantages: • ? • ...some bugs
  • 14. A Ruby You Can Compile • -c → Compile and assemble; good for multistage builds • -C → Compile, assemble, and link creating an *.rbo • Can also create stand-alone executables and entire “*.framework”s (experimental)
  • 15. I wanna be an App store billionaire... • Downloads contain Xcode templates (mostly work in Xcode 4) • Integration with Interface Builder • macruby_deploy • Includes BS files • Unpacks Gems • Compiles source
  • 16. I wanna be an App store billionaire...
  • 17. I wanna be an App store billionaire... QuickAlarm Briquette Timey Zero2Nine
  • 18. MacRuby Nuts & Bolts
  • 19. Garbage Collector: libauto • Yet another open source project from Apple • The GC for Obj-C • Based on write barriers • scanning, conservative, generational, multi- threaded garbage collector... • ...unfortunately...slow
  • 20. Garbage Collector: the Next Generation(?) • Ruby does A LOT of allocations • Nice to not have to stop the world, but... • Write barriers are slow • Maybe ref counting? • Maybe MRI’s collector isn’t so bad after all...
  • 21. RegExps: ICU • Oniguruma is not (real thread) thread safe • ICU is • thread safe • Unicode compatible • not as crazy feature-full as Oniguruma • There are some bugs...but honestly, stop doing that with RegExps!!!
  • 22. Hash method syntax • Ruby 1.9’s hash syntax with Symbol keys: a = { foo: 1, bar: 2, baz: “Hello, world” } • ...looks a bit like: [@”Hello, world” rangeOfString:@”Ello” options: NSCaseInsensitiveSearch] • Let’s go with that!
  • 23. Hash method syntax • MacRuby turns method calls with hash arguments into SEL • MacRuby turns method definitions with hash lists into SEL • MacRuby can call Objective-C • Objective-C can call MacRuby, but when possible you should use: [[MacRuby sharedRuntime] performRubySelector]
  • 24. LLVM, JIT, and Hacking • LLVM provides optimizations • LLVM provides JIT utilities (kinda slow) • MacRuby can emit LLVM... VM_DUMP_IR=1 macruby -e "def foo; puts 'hello'; end; foo" • Find other neat tricks in HACKING.rdoc
  • 25. GCD & The Future
  • 26. GCD • MacRuby can tap directly into GCD • Dispatch module: • Dispatch::Queue • Dispatch::Group • Dispatch::Source • Dispatch Gem too!
  • 27. GCD • Dispatch is a powerful tool for concurrent programming • Example: ControlTower • MacRuby Rack-based server • Uses GCD to handle requets • Accomplishes in 1 line what takes Thin/ EventMachine > 6000 lines of C++ & Ruby
  • 28. GCD
  • 29. GCD • Can we make GCD work in MRI? • JRuby thinks they can make it work... https://github.com/headius/jcd • GCD is Multithreaded Programming, Ruby Style

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n