SlideShare ist ein Scribd-Unternehmen logo
1 von 111
Why MacRuby Matters
Patrick Thomson

C4[3]

September 2009
Edsger Dijkstra
“Go To Statement Considered Harmful”
Dijkstraʼs Algorithm
“The effective exploitation of the
powers of abstraction must be
regarded as one of the most vital
activities of a computer
programmer.”
Objective-C
insufficiently powerful abstraction
What does Objective-C lack?
1. code reuse
inheritance alone
  is not enough
singletons
inheritance
In Objective-C:
1. create a static, shared instance
2. initialize once and only once
3. add an sharedInstance accessor method


       …for every singleton class.
               Tedious.
tedium sucks
mixins
units of behavior;
mix-in common functionality
 across unrelated classes
With mixins:

class Example
 include Singleton
 # your methods here
end
foo = Example.instance
not a new idea
Symbolics Lisp
1980
1. code reuse
2. safety
C is powerful.
C is powerful. (At the price of safety.)
We see Cʼs unsafeness throughout Objective-C.
raw pointers: bad news.
easily-confusable garbage collection
exceptions
creation, @try, and @throw are all expensive
Cocoa isnʼt exception-safe.
mishmash of NSError**,
NSException, and error codes
1. code reuse
2. safety
3. syntactic abstraction
[NSArray arrayWithObjects: @"a", @"b", @"c", nil];




                       vs.



                 ["a", "b", "c"]
[NSDictionary dictionaryWithObjectsAndKeys:
  @"Chicago", @"location", @"C4", @"event", nil];




                       vs.


   {"location" => "Chicago", "event" => "C4"}
[foo compare:bar] == NSComparisonResultAscending




                      vs.



                   foo < bar
I want a language that lets
       Cocoa shine.
MacRuby.
new Ruby implementation
+



powered by LLVM
+               +



on top of CoreFoundation
irb(main):001:0> "c4".class
=> NSMutableString
irb(main):002:0> [1, 2, 3].class
=> NSMutableArray
irb(main):003:0> {:tollfree => "bridging"}.class
=> NSMutableDictionary
irb(main):004:0> "/usr/local/bin".pathComponents
=> ["/", "usr", "local", "bin"]



 Ruby objects            Cocoa objects
irb(main):001:0>   3000.class
=> Fixnum
irb(main):002:0>   3000.is_a? NSNumber
=> true
irb(main):003:0>   3000.is_a? NSObject
=> true
irb(main):003:0>   3000.class.is_a? NSObject
=> true



    Everything is an NSObject
Laurent Sansonetti

Vincent Isambart


Rich Kilmer


Eloy Duran


Ben Stiglitz


Matt Aimonetti
MacRuby isnʼt…
a bridge
MacRuby != RubyCocoa
a toy
provides real solutions to
  real-world problems
example: threading
Global Interpreter Locks
only one system thread can touch
 the interpreter at any given time
prevents true multithreading
MacRuby has no GIL!
So why should you, as Cocoa
 developers, use MacRuby?
itʼs fast
historically slow
fib(40)
static int fib(int n)
{
  if (n < 3) {
    return 1;
  } else {
    return fib(n - 1) + fib(n - 2);
  }
}
@implementation Fib

- (int)fib:(int)n
{
  if (n < 3) {
    return 1;
  } else {
    return [self fib:n - 1] + [self fib:n - 2];
  }
}

@end
C        Objective-C
                     4




                     3
execution time (s)




                     2




                     1




                     0
                             fib(40)
def fib(n)
  if n < 3
    1
  else
    fib(n-1) + fib(n-2)
  end
end
C   MacRuby      Objective-C
                     4




                     3
execution time (s)




                     2




                     1




                     0
                                fib(40)
Faster than Objective-C‽
macruby --compile
first ahead-of-time compiler
         for Ruby
itʼs beautiful
Objective-C:




[obj setValue:val forKey:key]
Bridges:



obj.setValue_forKey(val, key)


     READABILITY FAIL
no_underscores_plz_k_thx
MacRuby:



obj.setValue(val, forKey:key)
HotCocoa
mapping Cocoa to idiomatic Ruby
[[NSImage alloc] initWithContentsOfFile:path];




                   becomes




             image(:file => path)
[[NSGradient alloc]
 initWithStartingColor: [NSColor greyColor]
           endingColor: [NSColor blueColor]];



                     becomes


gradient(:start => color(:name => "grey"),
         :end   => color(:name => "blue"))
a real, robust macro system
itʼs conceptually sound
single inheritance
open classes
message-based object model
dynamically typed
garbage-collected
Objective-C is C with the Smalltalk
     object model attached.


 Ruby is Smalltalk with C syntax.
itʼs fully integrated with the
       Cocoa toolchain
Yeah, We Got That
itʼs 100% compatible with every
        Cocoa framework
BridgeSupport lets you call any
 C-based API from MacRuby
CFStringGetLength("hello C4")
=> 8
queue = Dispatch::Queue.concurrent

queue.dispatch do
  puts "Asynchronous dispatch FTW!"
end
it provides features that
    Objective-C lacks
regular expressions,
tail-call optimization,
     namespaces,
        mixins,
operator overloading,
runtime evaluation…
What do you lose when going
from Objective-C to MacRuby?
static typing
JVM : Scala   Cocoa : ?
Where are we now?
almost 0.5
SVN trunk is stable
  (macruby.org)
nightly builds for 10.6 at
 macruby.icoretech.org
What does the future hold?
Last summer I had an internship at Apple.
  My views here, however, represent that of an open-source contributor,
 and not an Apple employee. Any speculations on the future of MacRuby
are entirely mine and are in no way representative of any plans, attitudes,
   or future directions that Apple may take. This presentation is neither
                     sponsored nor endorsed by Apple.

                       Apple: please donʼt sue me.
performance improvements
compatibility
not yet
Possible? Yes.
 Certain? No
ahead-of-time compiler
MacRuby → x86/ARM machine code
full mode: packed with interpreter
restricted mode:
no eval(), no interpreter
compliant with Appleʼs restrictions
  on interpreters in iPhone apps
we need garbage collection on
         the iPhone
Stay Informed
                      @lrz
                 @importantshock
                   @benstiglitz
@MacRuby         @vincentisambart
                 @mattaimonetti
                     @alloy

Weitere ähnliche Inhalte

Was ist angesagt?

Getting started with open cv in raspberry pi
Getting started with open cv in raspberry piGetting started with open cv in raspberry pi
Getting started with open cv in raspberry piJayaprakash Nagaruru
 
A Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with MultithreadingA Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with MultithreadingMatsuo and Tsumura lab.
 
Better performance through Superscalarity
Better performance through SuperscalarityBetter performance through Superscalarity
Better performance through SuperscalarityMårten Rånge
 
Python opcodes
Python opcodesPython opcodes
Python opcodesalexgolec
 
Wap to implement bitwise operators
Wap to implement bitwise operatorsWap to implement bitwise operators
Wap to implement bitwise operatorsHarleen Sodhi
 
openFrameworks 007 - utils
openFrameworks 007 - utilsopenFrameworks 007 - utils
openFrameworks 007 - utilsroxlu
 
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]Dimitrios Platis
 
C c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdoC c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdoKim Phillips
 
Exploring Color Spaces
 with Gesture Tracking and Smart Bulbs (Distill 2014)
Exploring Color Spaces
 with Gesture Tracking and Smart Bulbs (Distill 2014)Exploring Color Spaces
 with Gesture Tracking and Smart Bulbs (Distill 2014)
Exploring Color Spaces
 with Gesture Tracking and Smart Bulbs (Distill 2014)Daniel Luxemburg
 
Translating Classic Arcade Games to JavaScript
Translating Classic Arcade Games to JavaScriptTranslating Classic Arcade Games to JavaScript
Translating Classic Arcade Games to JavaScriptnorbert_kehrer
 
Modern c++ Memory Management
Modern c++ Memory ManagementModern c++ Memory Management
Modern c++ Memory ManagementAlan Uthoff
 
第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -Wataru Kani
 

Was ist angesagt? (20)

Lambda expressions in C++
Lambda expressions in C++Lambda expressions in C++
Lambda expressions in C++
 
Getting started with open cv in raspberry pi
Getting started with open cv in raspberry piGetting started with open cv in raspberry pi
Getting started with open cv in raspberry pi
 
A Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with MultithreadingA Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with Multithreading
 
Better performance through Superscalarity
Better performance through SuperscalarityBetter performance through Superscalarity
Better performance through Superscalarity
 
TVM VTA (TSIM)
TVM VTA (TSIM) TVM VTA (TSIM)
TVM VTA (TSIM)
 
Mini-curso JavaFX Aula1
Mini-curso JavaFX Aula1Mini-curso JavaFX Aula1
Mini-curso JavaFX Aula1
 
Python opcodes
Python opcodesPython opcodes
Python opcodes
 
The State of JavaScript
The State of JavaScriptThe State of JavaScript
The State of JavaScript
 
Wap to implement bitwise operators
Wap to implement bitwise operatorsWap to implement bitwise operators
Wap to implement bitwise operators
 
EcmaScript 6
EcmaScript 6 EcmaScript 6
EcmaScript 6
 
cpp_sample
cpp_samplecpp_sample
cpp_sample
 
openFrameworks 007 - utils
openFrameworks 007 - utilsopenFrameworks 007 - utils
openFrameworks 007 - utils
 
Mini-curso JavaFX Aula2
Mini-curso JavaFX Aula2Mini-curso JavaFX Aula2
Mini-curso JavaFX Aula2
 
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
 
OpenGL L06-Performance
OpenGL L06-PerformanceOpenGL L06-Performance
OpenGL L06-Performance
 
C c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdoC c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdo
 
Exploring Color Spaces
 with Gesture Tracking and Smart Bulbs (Distill 2014)
Exploring Color Spaces
 with Gesture Tracking and Smart Bulbs (Distill 2014)Exploring Color Spaces
 with Gesture Tracking and Smart Bulbs (Distill 2014)
Exploring Color Spaces
 with Gesture Tracking and Smart Bulbs (Distill 2014)
 
Translating Classic Arcade Games to JavaScript
Translating Classic Arcade Games to JavaScriptTranslating Classic Arcade Games to JavaScript
Translating Classic Arcade Games to JavaScript
 
Modern c++ Memory Management
Modern c++ Memory ManagementModern c++ Memory Management
Modern c++ Memory Management
 
第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -
 

Andere mochten auch

matco appreciation letter
matco appreciation lettermatco appreciation letter
matco appreciation letterRizwan Ali
 
Silent weapons for quiet wars
Silent weapons for quiet warsSilent weapons for quiet wars
Silent weapons for quiet warsOnes Frey
 
Was ist Twitter & wie funktioniert es - Unterlagen für Privat-Kurse (2014)
Was ist Twitter & wie funktioniert es - Unterlagen für Privat-Kurse (2014)Was ist Twitter & wie funktioniert es - Unterlagen für Privat-Kurse (2014)
Was ist Twitter & wie funktioniert es - Unterlagen für Privat-Kurse (2014)Monah Sorcelli
 
Third part nations - S-CCO leaked document 1
Third part nations - S-CCO leaked document 1Third part nations - S-CCO leaked document 1
Third part nations - S-CCO leaked document 1Marc Manthey
 
Nasa the futureof war
Nasa the futureof warNasa the futureof war
Nasa the futureof warMarc Manthey
 
Top Secret National Reconnaissance Office declassification guideline
Top Secret National Reconnaissance Office declassification guidelineTop Secret National Reconnaissance Office declassification guideline
Top Secret National Reconnaissance Office declassification guidelineMarc Manthey
 
Palavras Quanto à AcentuaçãO
Palavras Quanto à AcentuaçãOPalavras Quanto à AcentuaçãO
Palavras Quanto à AcentuaçãOPedroRecoba
 

Andere mochten auch (9)

Announcements for october 13, 2013
Announcements for october 13, 2013Announcements for october 13, 2013
Announcements for october 13, 2013
 
Eilidh Cerno Reference
Eilidh Cerno ReferenceEilidh Cerno Reference
Eilidh Cerno Reference
 
matco appreciation letter
matco appreciation lettermatco appreciation letter
matco appreciation letter
 
Silent weapons for quiet wars
Silent weapons for quiet warsSilent weapons for quiet wars
Silent weapons for quiet wars
 
Was ist Twitter & wie funktioniert es - Unterlagen für Privat-Kurse (2014)
Was ist Twitter & wie funktioniert es - Unterlagen für Privat-Kurse (2014)Was ist Twitter & wie funktioniert es - Unterlagen für Privat-Kurse (2014)
Was ist Twitter & wie funktioniert es - Unterlagen für Privat-Kurse (2014)
 
Third part nations - S-CCO leaked document 1
Third part nations - S-CCO leaked document 1Third part nations - S-CCO leaked document 1
Third part nations - S-CCO leaked document 1
 
Nasa the futureof war
Nasa the futureof warNasa the futureof war
Nasa the futureof war
 
Top Secret National Reconnaissance Office declassification guideline
Top Secret National Reconnaissance Office declassification guidelineTop Secret National Reconnaissance Office declassification guideline
Top Secret National Reconnaissance Office declassification guideline
 
Palavras Quanto à AcentuaçãO
Palavras Quanto à AcentuaçãOPalavras Quanto à AcentuaçãO
Palavras Quanto à AcentuaçãO
 

Ähnlich wie Why MacRuby Matters

Modified "Why MacRuby Matters"
Modified "Why MacRuby Matters"Modified "Why MacRuby Matters"
Modified "Why MacRuby Matters"Sean McCune
 
Mac ruby deployment
Mac ruby deploymentMac ruby deployment
Mac ruby deploymentThilo Utke
 
Mac ruby to the max - Brendan G. Lim
Mac ruby to the max - Brendan G. LimMac ruby to the max - Brendan G. Lim
Mac ruby to the max - Brendan G. LimThoughtWorks
 
MacRuby to The Max
MacRuby to The MaxMacRuby to The Max
MacRuby to The MaxBrendan Lim
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective cMayank Jalotra
 
Ruby Meets Cocoa
Ruby Meets CocoaRuby Meets Cocoa
Ruby Meets CocoaRobbert
 
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012rivierarb
 
Java Keeps Throttling Up!
Java Keeps Throttling Up!Java Keeps Throttling Up!
Java Keeps Throttling Up!José Paumard
 
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...Yandex
 
C optimization notes
C optimization notesC optimization notes
C optimization notesFyaz Ghaffar
 
GUI Programming with MacRuby
GUI Programming with MacRubyGUI Programming with MacRuby
GUI Programming with MacRubyErik Berlin
 
Macruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich KilmerMacruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich KilmerMatt Aimonetti
 
Experiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRubyExperiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRubyMatthew Gaudet
 
Things about Functional JavaScript
Things about Functional JavaScriptThings about Functional JavaScript
Things about Functional JavaScriptChengHui Weng
 
Functional Smalltalk
Functional SmalltalkFunctional Smalltalk
Functional SmalltalkESUG
 
Cray XT Porting, Scaling, and Optimization Best Practices
Cray XT Porting, Scaling, and Optimization Best PracticesCray XT Porting, Scaling, and Optimization Best Practices
Cray XT Porting, Scaling, and Optimization Best PracticesJeff Larkin
 
Writing a Gem with native extensions
Writing a Gem with native extensionsWriting a Gem with native extensions
Writing a Gem with native extensionsTristan Penman
 

Ähnlich wie Why MacRuby Matters (20)

Modified "Why MacRuby Matters"
Modified "Why MacRuby Matters"Modified "Why MacRuby Matters"
Modified "Why MacRuby Matters"
 
MacRuby, an introduction
MacRuby, an introductionMacRuby, an introduction
MacRuby, an introduction
 
Mac ruby deployment
Mac ruby deploymentMac ruby deployment
Mac ruby deployment
 
Jvm internals
Jvm internalsJvm internals
Jvm internals
 
Mac ruby to the max - Brendan G. Lim
Mac ruby to the max - Brendan G. LimMac ruby to the max - Brendan G. Lim
Mac ruby to the max - Brendan G. Lim
 
MacRuby to The Max
MacRuby to The MaxMacRuby to The Max
MacRuby to The Max
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective c
 
Ruby Meets Cocoa
Ruby Meets CocoaRuby Meets Cocoa
Ruby Meets Cocoa
 
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
 
Java Keeps Throttling Up!
Java Keeps Throttling Up!Java Keeps Throttling Up!
Java Keeps Throttling Up!
 
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...
 
C optimization notes
C optimization notesC optimization notes
C optimization notes
 
Swift, swiftly
Swift, swiftlySwift, swiftly
Swift, swiftly
 
GUI Programming with MacRuby
GUI Programming with MacRubyGUI Programming with MacRuby
GUI Programming with MacRuby
 
Macruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich KilmerMacruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich Kilmer
 
Experiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRubyExperiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRuby
 
Things about Functional JavaScript
Things about Functional JavaScriptThings about Functional JavaScript
Things about Functional JavaScript
 
Functional Smalltalk
Functional SmalltalkFunctional Smalltalk
Functional Smalltalk
 
Cray XT Porting, Scaling, and Optimization Best Practices
Cray XT Porting, Scaling, and Optimization Best PracticesCray XT Porting, Scaling, and Optimization Best Practices
Cray XT Porting, Scaling, and Optimization Best Practices
 
Writing a Gem with native extensions
Writing a Gem with native extensionsWriting a Gem with native extensions
Writing a Gem with native extensions
 

Kürzlich hochgeladen

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
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
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
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
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

Kürzlich hochgeladen (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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)
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
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
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
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
 
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...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

Why MacRuby Matters

Hinweis der Redaktion

  1. Introductions. Thank Wolf. Banter.
  2. Many of you may recognize this person.
  3. contributions to structured programming
  4. revolutionary graph-search algorithm that powers just about every network routing protocol
  5. this quote of Dijkstra&amp;#x2019;s draws attention to a central conundrum facing Cocoa programmers today
  6. the conundrum is this: Objective-C, the language we all know and love&amp;#x2026;
  7. &amp;#x2026;provides us with an insufficiently powerful level of abstraction. We build the best desktop apps out there, but we do it in spite of ObjC.
  8. So, as a language, what does ObjC lack?
  9. I submit that perhaps the most fundamental problem with ObjC is its lack of support for code reuse. At the Objective-C level of abstraction, effective code reuse is like pulling teeth.
  10. And sure, inheritance provides a good measure of code reuse. But for many use cases, it simply doesn&amp;#x2019;t apply.
  11. Consider the singleton. It&amp;#x2019;s a great example of a common Objective-C pattern which cannot be abstracted out, forcing us to resort to boilerplate code.
  12. Every singleton class needs its own static, shared instance. Single inheritance can&amp;#x2019;t solve the problem, and it&amp;#x2019;s questionable that multiple inheritance is the right solution in this case.
  13. So, creating a singleton in Objective-C is really tedious. Add to the fact that very few people agree on the right way to go about this tedium - should you synchronize on sharedInstance, or init? Should you check for NULL or use pthread_once or dispatch_once? - and ensuring proper behavior seems hardly worth the trouble. It&amp;#x2019;s too tedious.
  14. And tedium sucks.
  15. A sufficiently powerful language would provide us with a code reuse mechanism like mixins.
  16. Mixins, for those who haven&amp;#x2019;t heard of them, provide another level of abstraction into class definitions. Like classes, you define them and define method implementations in them; however, instead of including them in the class hierarchy, you mix them into classes - the resulting class copies the methods you defined in your mixin.
  17. Here&amp;#x2019;s an example. In this language, the &amp;#x201C;include&amp;#x201D; keyword mixes a mixin into a class. By including the Singleton mixin in this class, it defines initialization and accessor methods as well as setting aside a static, shared instance.
  18. Now we can access the shared instance. Easy.
  19. And sure, I understand that the Objective-C language designers held off on implementing New and Fancy Ideas. And I agree with them.
  20. But mixins have been around since Symbolics Lisp. Anyone remember that? I don&amp;#x2019;t. I wasn&amp;#x2019;t even born yet.
  21. That was a while ago. And we, as Mac programmers, should ask more from our development tools.
  22. Though Objective-C has a huge advantage in that it&amp;#x2019;s based on C, it also has a huge disadvantage - that it&amp;#x2019;s based on C.
  23. Being a representation of a Von Neumann machine, C can solve any computable problem. But what&amp;#x2019;s interesting is that C is actually pretty expressive, even when you need to do fancy, comp-sci-sexy things. You&amp;#x2019;ve got a reasonable approximation of continuations with setjmp, of exceptions with sigsetjmp, and first-class functions with function pointers.
  24. But all of these things are hideously unsafe. We&amp;#x2019;re programmers, not superheroes - if our tools allow us to make a mistake, we will make it.
  25. And C&amp;#x2019;s unsafeness is visible in almost every part Objective-C.
  26. We program in a high-level language. Why do we still have the ability to shoot ourselves so profoundly in the foot with raw pointers? You, or the library functions you call, can stomp all over memory silently and watch as you drown in bizarre and irreproducible behavior.
  27. C&amp;#x2019;s ability to treat just about anything as a memory address means that you can bamboozle the hell out of the garbage collector.
  28. Nowhere is the unsafe and backwards nature of C - and consequently, Objective-C - more apparent than exceptions. C really doesn&amp;#x2019;t play nice with the notion of exceptions at all, and has therefore hobbled ObjC exception support throughout ObjC&amp;#x2019;s lifetime.
  29. ObjC exception handling is horrifically inefficient. Since on 32-bit exceptions are based on setjmp and longjmp, pretty much everything about them are expensive. Exception creation and try-blocks got much faster with 64-bit C++-compatible exceptions, but throwing them got even slower.
  30. And the kicker is that the vast majority of Cocoa frameworks aren&amp;#x2019;t exception-safe. So there is absolutely no guarantee that objects will be cleaned up or finalized properly if you throw an exception.
  31. So thanks to this, nobody ever checks for exceptions - honestly, when was the last time you checked for alloc throwing an NSMallocException? - and we make do with functions that take pointers to NSErrors and some functions that return either Carbon, Cocoa, POSIX, or Mach error codes.
  32. Go ahead. Call me lazy.
  33. But I&amp;#x2019;m tired of creating arrays manually. I want a language that has sufficient syntactic abstraction so that I can just create arrays inline. I mean, imagine if we had to do this to create NSStrings - it would be endlessly tedious!
  34. And don&amp;#x2019;t even get me started on how tedious NSDictionary creation is. These may seem like syntactic quibbles to some of you, but I know that in the past I&amp;#x2019;ve avoided using dictionaries in favor of long if-else statements, just because creating dictionaries is so tedious!
  35. Similarly, I want operator overloading, because it lets me say what I mean. I want the less-than sign to be transformed into a call to compare - and let&amp;#x2019;s be frank, operator overloading is never going to come to Objective-C.
  36. Basically, I want a language that&amp;#x2019;s as well-designed as Cocoa.
  37. And so far, the closest I have come to that ideal is when I write code in MacRuby.
  38. For those of you that haven&amp;#x2019;t heard of it, MacRuby is a new implementation of Ruby, a scripting language from Japan.
  39. MacRuby differs from the standard implementation of Ruby 1.9 in that its its virtual machine, optimization routines, bytecode generation, and just-in-time compilation are all implemented on top of LLVM, the Low-Level Virtual Machine project. LLVM is already blazingly fast, and I&amp;#x2019;m confident that its performance will only continue to improve.
  40. In addition to replacing the Ruby 1.9 VM with the LLVM one, we also reimplemented the standard Ruby data structures on top of CoreFoundation. In addition to providing us with a set of memory-efficient, fast, and mature set of data structures, implementing MacRuby on top of Core Foundation also ensured that&amp;#x2026;
  41. &amp;#x2026;Ruby objects are absolutely indistinguishable from Cocoa objects - they even respond to the same API calls! NS/CFStrings are Ruby strings, NS/CFArrays are Ruby arrays, NS/CFDictionaries are Ruby hashes.
  42. But we go beyond what Objective-C offers, and return to a Smalltalk heritage where there are no primitive types. Everything descends from NSObject, even floats and integers.
  43. Though MacRuby is an Apple-supported project, it is released under the Ruby license so you can embed it into your commercial applications.
  44. The MacRuby team is one of the smartest and most focused I&amp;#x2019;ve ever seen. Laurent Sansonetti, an employee at Apple, started MacRuby just as an experiment to see how well Ruby would run on top of the Objective-C runtime and garbage collector. Yet in its current form, I truly believe that it&amp;#x2019;s stable enough
  45. Clarification!
  46. Bridges, as Tim pointed out in C4[1], are unreliable, difficult, and tend to be slow.
  47. Explain the differences.
  48. not a toy!
  49. everyone has to deal with it sooner or later
  50. explain what they are, what systems (Python, Ruby, Lua) use them
  51. explain how much they suck
  52. green threads suck
  53. So. The big question.
  54. MacRuby is fast. Not just Fast Enough, but fast.
  55. This may surprise many of you, as most people know Ruby as &amp;#x201C;that weird, slow, Japanese space-Perl.&amp;#x201D; And the conception that Ruby is slower than other comparable languages has been true - up until now.
  56. A good example of the speed boosts that we aim for is the Fibonacci sequence.
  57. Take na&amp;#xEF;ve implementations of the Fibonacci sequence, using recursion, in C&amp;#x2026;
  58. and in Objective-C (using ObjC message sending),
  59. and, predictably, C is going to be a lot faster. And trying to get MacRuby faster than C for everything is beyond the scope of this project.
  60. But take the same Fibonacci implementation in Ruby, run it under MacRuby&amp;#x2026;
  61. and we see that MacRuby is, in this benchmark, faster than Objective-C.
  62. The answer lies in the --compile flag. MacRuby can compile Ruby source down to Mach-O x86 executables.
  63. This is hugely exciting. Nobody else has done this before. And up until now, shipping a closed-source desktop application written in Ruby has been a Bad Idea - but now you can hide your source code from prying eyes.
  64. keyword syntax is readable.
  65. worst of both worlds: verbosity of keyword syntax and unreadability of ALGOL-style syntax
  66. syntactic extensions to make ObjC calls look gorgeous.
  67. optional set of layers
  68. to make common idioms concise
  69. nestable, elegant, yet completely optional
  70. like in Lisp and Scheme
  71. Ruby and Objective-C are almost absurdly similar - how similar, you ask?
  72. look at these features!
  73. practically cousins
  74. first-class environment
  75. xcode templates, interface builder integration, instruments templates, dtrace scripts
  76. leave nothing behind
  77. mention that Laurent wrote it
  78. contrived example, but talk about CoreImage, CoreGraphics, PDF documents
  79. hooray for my GCD layer
  80. talk about how things just work, and plug topfunky&amp;#x2019;s MacRuby screencast
  81. hooray
  82. whine about all of these features
  83. be honest!
  84. Though one can obviously treat Objective-C like a dynamic language, and give the &amp;#x2018;id&amp;#x2019; type to everything, well-written and idiomatic Objective-C code takes advantage of static typing to catch errors before they happen. And because Ruby is a duck-typed language, you&amp;#x2019;re going to lose some power.
  85. And rather than viewing this as a problem for MacRuby, I think this is a great opportunity for another language to come in and apply all the innovations in the world of static typing - type inference, currying, existential types - to the world of Cocoa. So, uh, someone get on that.
  86. The 0.5 release of MacRuby is almost upon us. This release will be the first one based on the new virtual machine.
  87. If you want to play with the new features now, I recommend checking out the source from MacRuby.org
  88. or get builds for Snowy.
  89. DISCLAIMER! I&amp;#x2019;m here to talk about what is TECHNICALLY POSSIBLE, not what&amp;#x2019;s *going* to happen.
  90. we want to be the fastest Ruby implementation around
  91. we still need continuations, fibers, and to make all C exts compatible
  92. The first thing people usually ask about MacRuby is &amp;#x201C;Does it run Rails yet?&amp;#x201D;
  93. No. It doesn&amp;#x2019;t. And though we&amp;#x2019;d like to have it run Rails in the future, there&amp;#x2019;s still a lot of work to be done in that direction - revamping the sockets interface, improving IO speed and flexibility, and making sure that MacRuby supports all the maddening little metaprogramming quirks of which Rails takes advantage.
  94. Much more interesting to me is the question of whether or not
  95. it&amp;#x2019;s up to the lawyers
  96. i mentioned this already
  97. for metaprogramming and eval
  98. hopefully that will come soon