SlideShare ist ein Scribd-Unternehmen logo
1 von 30
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/

Weitere ähnliche Inhalte

Was ist angesagt?

XRuby_Overview_20070831
XRuby_Overview_20070831XRuby_Overview_20070831
XRuby_Overview_20070831dreamhead
 
Ruby projects of interest for DevOps
Ruby projects of interest for DevOpsRuby projects of interest for DevOps
Ruby projects of interest for DevOpsRicardo Sanchez
 
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 Toolfilmprog
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02sagaroceanic11
 
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 RubyEvgeny Rahman
 
JRuby in the enterprise
JRuby in the enterpriseJRuby in the enterprise
JRuby in the enterpriseJerry 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 TechnologiesLogeekNightUkraine
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRubyelliando 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 Railselliando dias
 
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 Bartlettmfrancis
 
Java virtual machine 101
Java virtual machine 101Java virtual machine 101
Java virtual machine 101Sarath 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
 
Java Closures
Java ClosuresJava Closures
Java ClosuresBen Evans
 

Was ist angesagt? (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
 

Andere mochten auch

Andere mochten auch (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
 

Ähnlich wie MacRuby: What is it? and why should you care?

Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin ProgrammingAtlassian
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLBarry 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 2016Charles Nutter
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyistsbobmcwhirter
 
GUI Programming with MacRuby
GUI Programming with MacRubyGUI Programming with MacRuby
GUI Programming with MacRubyErik Berlin
 
Mac ruby deployment
Mac ruby deploymentMac ruby deployment
Mac ruby deploymentThilo 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 TitaniumTechday7
 
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 ClojureTroy 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 RuntimesCharlie Gracie
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVMJung Kim
 
MacRuby For Ruby Developers
MacRuby For Ruby DevelopersMacRuby For Ruby Developers
MacRuby For Ruby DevelopersRenzo 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
 

Ähnlich wie 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 ?
 

Kürzlich hochgeladen

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

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

Hinweis der Redaktion

  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