• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
MacRuby on Rails
 

MacRuby on Rails

on

  • 4,121 views

This is my presentation in RubyConf 2011, 30th Octobar 2011,New Orleans in the U.S....

This is my presentation in RubyConf 2011, 30th Octobar 2011,New Orleans in the U.S.

Abstract:
MacRuby is an implementation of Ruby 1.9 that is built directly on top of Mac OS X core technologies. Recently, MacRuby has become viable as a tool for developing useful desktop applications for Mac OS X. However, as of March 2011, MacRuby is still missing some functionality that is present in cRuby. Therefore, MacRuby is not able to run Ruby on Rails. In my presentation, I will explain how I modified MacRuby to make it a suitable foundation for running Rails. I would also like to explain some of the technical intricacies that I discovered along the way.

RubyConf 2011:
http://rubyconf.org/

Statistics

Views

Total Views
4,121
Views on SlideShare
4,041
Embed Views
80

Actions

Likes
1
Downloads
25
Comments
0

4 Embeds 80

http://paper.li 48
http://a0.twimg.com 17
http://us-w1.rockmelt.com 13
https://twitter.com 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    MacRuby on Rails MacRuby on Rails Presentation Transcript

    • MacRuby on RailsAbstractMacRuby is an implementation of Ruby 1.9 that is built directly ontop of Mac OS X core technologies. Recently, MacRuby hasbecome viable as a tool for developing useful desktop applicationsfor Mac OS X. However, as of March 2011, MacRuby is stillmissing some functionality that is present in cRuby. Therefore,MacRuby is not able to run Ruby on Rails. In my presentation, Iwill explain how I modified MacRuby to make it a suitablefoundation for running Rails. I would also like to explain some ofthe technical intricacies that I discovered along the way. This presentation was made possible by
    • Kouji Takao
    • Work• Network Applied Communication Laboratory Ltd.• System design, programming, planning and meeting
    • Spare Time• MacRuby committer ➡Core• cRuby committer ➡Readline module
    • Contact Information• kouji.takao@gmail.com• @takaokouji_en• http://facebook.com/takaokouji (mainly in Japanese)
    • My Company
    • My Company• Network Applied Communication Laboratory Ltd.
    • My Company• Network Applied Communication Laboratory Ltd.• a.k.a NaCl
    • My Company• Network Applied Communication Laboratory Ltd.• a.k.a NaCl ➡ means salt
    • My Company
    • My Company• http://www.netlab.jp/
    • My Company• http://www.netlab.jp/• Shimane, Japan
    • My Company• http://www.netlab.jp/• Shimane, Japan• Since 2001
    • My Company• http://www.netlab.jp/• Shimane, Japan• Since 2001 ➡ 10th Anniversary!
    • My Company• http://www.netlab.jp/• Shimane, Japan• Since 2001 ➡ 10th Anniversary!• 57 people
    • My Company• http://www.netlab.jp/• Shimane, Japan• Since 2001 ➡ 10th Anniversary!• 57 people ➡ 6 people are cRuby committers
    • My Company• http://www.netlab.jp/• Shimane, Japan• Since 2001 ➡ 10th Anniversary!• 57 people ➡ 6 people are cRuby committers• SI, Training, etc...
    • The NaCl Way
    • The NaCl Way NaCls President
    • The NaCl Way
    • The NaCl Way First, I want You to be happy.
    • The NaCl Way First, I want You to be happy. Next, I want you to make Your Family happy.
    • The NaCl Way First, I want You to be happy. Next, I want you to make Your Family happy. Finally, if you have more happiness left, then please share it with Our Company :)
    • The NaCl Way (as I see it)
    • The NaCl Way (as I see it)Employee• First: Employee
    • The NaCl Way (as I see it) EmployeesEmployee Family• First: Employee• Next: Employees Family
    • The NaCl Way (as I see it) EmployeesEmployee Company Family• First: Employee• Next: Employees Family• Finally: Company
    • The NaCl Way (as I see it) EmployeesEmployee Company Family• First: Employee• Next: Employee Family• Finally: Company
    • The NaCl Way (as I see it) y m ! e y! v n Employees lo aEmployee Company Family I p•• First: Employee c o m Next: Employee Family• Finally: Company
    • MacRuby on Rails
    • MacRuby on Rails
    • MacRuby on Rails
    • MacRuby on RailsIn my presentation,I will explain how I modified MacRuby tomake it a suitable foundation for running Rails.I would also like to explain some of the MacRuby on Railstechnical internals that I discovered along theway.
    • MacRuby on Rails
    • MacRubyRuby customized for Mac OS X
    • MacRuby
    • MacRuby• MacRuby is a unique blend of Ruby 1.9 and Objective-C.
    • MacRuby• MacRuby is a unique blend of Ruby 1.9 and Objective-C.• The goal of the MacRuby project is to be 100% compatible syntactically and behaviorally with Ruby 1.9.
    • Ruby 1.9 Application Ruby 1.9 Built-in Ruby VM GC Built-in Standard Library Library System libraries OS(Linux,Windows,Mac OS X,etc...)
    • Ruby 1.9 Application Ruby 1.9 Built-in Ruby VM GC Built-in Standard Library Library System libraries OS(Linux,Windows,Mac OS X,etc...)
    • Ruby 1.9 Application Ruby 1.9 Built-in Ruby VM GC Built-in Standard Library Library System libraries OS(Linux,Windows,Mac OS X,etc...)
    • Ruby 1.9 Application Ruby 1.9 Built-in Ruby VM GC Built-in Standard Library Library System libraries OS(Linux,Windows,Mac OS X,etc...)
    • Ruby 1.9 Application Ruby 1.9 Built-in Ruby VM GC Built-in Standard Library Library System libraries OS(Linux,Windows,Mac OS X,etc...)
    • Ruby 1.9 Application Ruby 1.9 Built-in Ruby VM GC Built-in Standard Library Library System libraries OS(Linux,Windows,Mac OS X,etc...)
    • Ruby 1.9 Application Ruby 1.9 Built-in Ruby VM GC Built-in Standard Library Library System libraries OS(Linux,Windows,Mac OS X,etc...)
    • Ruby 1.9 Application Ruby 1.9 Built-in Ruby VM GC Built-in Standard Library Library System libraries OS(Linux,Windows,Mac OS X,etc...)
    • Ruby 1.9 Application Ruby 1.9 Built-in Ruby VM GC Built-in Standard Library Library System libraries OS(Linux,Windows,Mac OS X,etc...)
    • Ruby 1.9 Application Ruby 1.9 Built-in Ruby VM GC Built-in Standard Library Library System libraries OS(Linux,Windows,Mac OS X,etc...)
    • MacRuby Application MacRuby Built-inRuby VM GCBuilt-in StandardLibrary Library System libraries Mac OS X
    • MacRuby Application MacRuby Built-inRuby VM GCBuilt-in StandardLibrary Library System libraries Mac OS X
    • MacRuby Application MacRuby Built-inRuby VM GCBuilt-in StandardLibrary Library System libraries Mac OS X
    • MacRuby Application MacRuby Built-inRuby VM GCBuilt-in StandardLibrary Library System libraries Mac OS X
    • MacRuby Application MacRubyRuby VM AutoZone Built-in GCBuilt-in StandardLibrary Library System libraries Mac OS X
    • MacRuby Application MacRuby Ruby VM AutoZone Built-in GCFoundation Built-in Standard Library Library System libraries Mac OS X
    • MacRuby Application MacRuby Ruby VM AutoZone Built-in GCFoundation Built-in Standard Library Library"kouji".transform("latin-hiragana") System libraries#=> Mac OS X
    • MacRuby Application MacRuby Ruby VM AutoZone Built-in GCFoundation Built-in Standard Library Library System libraries Mac OS X
    • MacRuby Application MacRuby Ruby VM AutoZone Built-in GCFoundation Built-in Standard Library Library System libraries Mac OS X
    • MacRuby Application MacRuby Ruby VM AutoZone Built-in GCFoundation Built-in Standard Library Library System libraries Mac OS X
    • MacRuby Application MacRuby Ruby VM AutoZone Built-in GCFoundation Built-in Standard Library Library System libraries Mac OS X
    • MacRuby Application MacRuby AutoZone Generational LLVM Threaded GC Built-in Standard Library LibraryFoundation System libraries Mac OS X
    • MacRuby on RailsMaking Ruby on Rails work on MacRuby
    • Current Status
    • Current Status$ rails new demo
    • Current Status$ rails new demo $ rails generate scaffold ...
    • Current Status$ rails new demo $ rails generate scaffold ... $ rails server
    • Current Status$ rails new demo $ rails generate scaffold ... $ rails server
    • 7 months ago...
    • 7 months ago...March 2011 in Japan
    • 7 months ago...March 2011 in Japan• I thought, "Does Rails work on MacRuby?".
    • 7 months ago...March 2011 in Japan• I thought, "Does Rails work on MacRuby?".• I managed to install Rails.$ sudo macgem install rails7 gems installed$ sudo macgem install sqlite3-ruby2 gems installed
    • Perhaps...
    • Perhaps...• I thought, "OK, its installed, but surely the Rails generators wont work...".
    • Perhaps... • I thought, "OK, its installed, but surely the Rails generators wont work...". • However, I managed to create a Rails project!?$ macruby -S rails new demo create create README ... create vendor/plugins create vendor/plugins/.gitkeep
    • Are you kidding me?
    • Are you kidding me?• I tried to generate a scaffold...
    • Are you kidding me?• I tried to generate a scaffold...• It failed. After all Rails didnt work on MacRuby.$ macruby -S rails generate scaffold Bookmarktitle:string description:text url:string...Assertion failed: ((size_t)pos <current_exceptions.size()), functionpop_current_exception, file vm.cpp, line 3434.zsh: abort macruby -S rails generate scaffoldBookmark title:string description:text
    • Are you kidding me?• I tried to generate a scaffold...• It failed. After all Rails didnt work on MacRuby.$ macruby -S rails generate scaffold Bookmarktitle:string description:text url:string $ macruby -S rails server... ...Assertion failed: ((size_t)pos < < Assertion failed: ((size_t)poscurrent_exceptions.size()), function current_exceptions.size()), functionpop_current_exception, file file vm.cpp, line 3434. pop_current_exception, vm.cpp, line 3434.zsh:zsh: abort macruby -S rails generate scaffold abort macruby -S rails serverBookmark title:string description:text
    • My approach Run RailsSEGV or abort Research CodingRun RubySpec Run Rails
    • My approach Run RailsSEGV or abort Research CodingRun RubySpec Run Rails
    • My approach Run RailsSEGV or abort Research CodingRun RubySpec Run Rails
    • My approach Run RailsSEGV or abort Research CodingRun RubySpec Run Rails
    • My approach Run RailsSEGV or abort Research CodingRun RubySpec Run Rails
    • My approach Run RailsSEGV or abort Research CodingRun RubySpec Run Rails
    • Coding My approachRun RubySpec Run RailsSEGV or abort Research CodingRun RubySpec
    • Coding My approachRun RubySpec Run Rails Required knowledgeSEGV or abort and technology • cRuby Research • Objective-C Coding • C++Run RubySpec • LLVM
    • A couple of examples ofwhat I have fixed so far
    • #860 catch/throw (in "old" MacRuby)➡ MacRuby aborts if you use catch and throw inside a rescue clause.
    • #860 catch/throw (in "old" MacRuby)➡ MacRuby aborts if you use catch and throw inside a rescue clause.01: begin02: raise "A"03: rescue04: catch(:foo) { throw :foo }05: end
    • #860 catch/throw (in "old" MacRuby) ➡ MacRuby aborts if you use catch and throw inside a rescue clause. 01: begin 02: raise "A" 03: rescue 04: catch(:foo) { throw :foo } 05: end:okAssertion failed: ((size_t)pos < current_exceptions.size()),function pop_current_exception, file vm.cpp, line 3448.
    • Exception Handling (in MacRuby)
    • Exception Handling (in MacRuby)01: begin02: raise "A"03: rescue04: begin05: raise "B"06: rescue07: end08: end
    • Exception Handling (in MacRuby)01: begin02: raise "A"03: rescue04: begin05: raise "B"06: rescue07: end08: end
    • Exception Handling (in MacRuby)01: begin02: raise "A"03: rescue04: begin05: raise "B"06: rescue07: end08: end Exception Stack
    • Exception Handling (in MacRuby)01: begin02: raise "A" push03: rescue04: begin05: raise "B"06: rescue07: end08: end "A" Exception Stack
    • Exception Handling (in MacRuby)01: begin02: raise "A" push03: rescue04: begin05: raise "B"06: rescue07: end08: end "A" Exception Stack
    • Exception Handling (in MacRuby)01: begin02: raise "A" push03: rescue04: begin05: raise "B" push06: rescue "B"07: end08: end "A" Exception Stack
    • Exception Handling (in MacRuby)01: begin02: raise "A" push03: rescue04: begin05: raise "B" push06: rescue "B"07: end08: end "A" Exception Stack
    • Exception Handling (in MacRuby)01: begin02: raise "A" push03: rescue04: begin05: raise "B" push06: rescue07: end pop08: end "A" Exception Stack
    • Exception Handling (in MacRuby)01: begin02: raise "A" push03: rescue04: begin05: raise "B" push06: rescue07: end pop08: end pop Exception Stack
    • Exception Handling and catch / throw (in MacRuby) Exception Stack
    • Exception Handling and catch / throw (in MacRuby)01: catch(:foo) {02: begin03: raise "A"04: rescue05: throw :foo06: end07: } Exception Stack
    • Exception Handling and catch / throw (in MacRuby)01: catch(:foo) {02: begin03: raise "A"04: rescue05: throw :foo06: end07: } Exception Stack
    • Exception Handling and catch / throw (in MacRuby)01: catch(:foo) {02: begin03: raise "A" push04: rescue05: throw :foo06: end07: } "A" Exception Stack
    • Exception Handling and catch / throw (in MacRuby)01: catch(:foo) {02: begin03: raise "A" push04: rescue05: throw :foo06: end07: } "A" Exception Stack
    • Exception Handling and catch / throw (in MacRuby)01: catch(:foo) {02: begin03: raise "A" push04: rescue05: throw :foo06: end07: } "A" Exception Stack
    • Exception Handling and catch / throw (in MacRuby)01: catch(:foo) {02: begin03: raise "A" push04: rescue05: throw :foo pop06: end07: } Exception Stack
    • throw (in "old " MacRuby)Before being fixed(60723bf~), throw alwayspopped the current Exception.vm.cpp:4321:VALUERoxorVM::ruby_throw(VALUE tag, VALUE value){... if (current_exception() != Qnil) { pop_current_exception(); }...
    • throw (in "old " MacRuby)Before being fixed(60723bf~), throw alwayspopped the current Exception.vm.cpp:4321:VALUERoxorVM::ruby_throw(VALUE tag, VALUE value){... if (current_exception() != Qnil) { pop_current_exception(); }...
    • throw (in "old " MacRuby)Before being fixed(60723bf~), throw alwayspopped the current Exception.vm.cpp:4321:VALUERoxorVM::ruby_throw(VALUE tag, VALUE value){... if (current_exception() != Qnil) { pop_current_exception(); }...
    • #860 catch/throw (in "old" MacRuby)01: begin02: raise "A"03: rescue04: catch(:foo) { throw :foo }05: end Exception Stack
    • #860 catch/throw (in "old" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { throw :foo }05: end "A" Exception Stack
    • #860 catch/throw (in "old" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { throw :foo }05: end "A" Exception Stack
    • #860 catch/throw (in "old" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { throw :foo } pop05: end Exception Stack
    • #860 catch/throw (in "old" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { throw :foo } pop05: end pop Exception Stack
    • #860 catch/throw (in "old" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { throw :foo } pop05: end pop t ! ! o r A b Exception Stack
    • How to fix (in "new" MacRuby)01: begin02: raise "A"03: rescue04: catch(:foo) { throw :foo }05: end Exception Stack
    • How to fix (in "new" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { throw :foo }05: end "A" Exception Stack
    • How to fix (in "new" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { throw :foo } store05: end "A" Exception Stack
    • How to fix (in "new" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { throw :foo } store05: end "A" Exception Stack
    • How to fix (in "new" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { throw :foo } store05: end pop Exception Stack
    • How to fix (in "new" MacRuby)In the new implementation, MacRuby only popsexceptions when necessary (60723bf)vm.cpp:4318:VALUERoxorVM::ruby_throw(VALUE tag, VALUE value){... while (catch_ptr->current_exception != current_exception()) { pop_current_exception(); }...
    • How to fix (in "new" MacRuby)In the new implementation, MacRuby only popsexceptions when necessary (60723bf)vm.cpp:4318:VALUERoxorVM::ruby_throw(VALUE tag, VALUE value){... while (catch_ptr->current_exception != current_exception()) { pop_current_exception(); }...
    • How to fix (in "new" MacRuby)In the new implementation, MacRuby only popsexceptions when necessary (60723bf)vm.cpp:4318:VALUERoxorVM::ruby_throw(VALUE tag, VALUE value){... while (catch_ptr->current_exception != current_exception()) { pop_current_exception(); }...
    • #860 Fixed (in "new" MacRuby)01: begin02: raise "A"03: rescue04: catch(:foo) {05: begin06: raise "B"07: rescue08: throw :foo09: end10: }11: end Exception Stack
    • #860 Fixed (in "new" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { store05: begin06: raise "B"07: rescue08: throw :foo09: end "A"10: }11: end Exception Stack
    • #860 Fixed (in "new" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { store05: begin06: raise "B" push07: rescue "B"08: throw :foo09: end "A"10: }11: end Exception Stack
    • #860 Fixed (in "new" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { store05: begin06: raise "B" push07: rescue "B"08: throw :foo09: end "A"10: }11: end Exception Stack
    • #860 Fixed (in "new" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { store05: begin06: raise "B" push07: rescue08: throw :foo pop09: end "A"10: }11: end Exception Stack
    • #860 Fixed (in "new" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { store05: begin06: raise "B" push07: rescue08: throw :foo pop09: end "A"10: }11: end Exception Stack
    • #860 Fixed (in "new" MacRuby)01: begin02: raise "A" push03: rescue04: catch(:foo) { store05: begin06: raise "B" push07: rescue08: throw :foo pop09: end10: }11: end pop Exception Stack
    • #1192 Constant Lookup➡ MacRuby failed to correctly look up constants in a number of situations when you used module_eval and class_eval.
    • #1192 Constant Lookup➡ MacRuby failed to correctly look up constants in a number of situations when you used module_eval and class_eval. module A B = 10 Object.class_eval { B } end
    • #1192 Constant Lookup ➡ MacRuby failed to correctly look up constants in a number of situations when you used module_eval and class_eval. module A B = 10 Object.class_eval { B } endreduction.rb:3:in `block: uninitialized constantB (NameError)
    • #1192 Constant Lookup ➡ MacRuby failed to correctly look up constants in a number of situations when you used module_eval and class_eval. module A cRuby B = 10 Object.class_eval { B } endreduction.rb:3:in `block: uninitialized constantB (NameError)
    • #1192 Constant Lookup ➡ MacRuby failed to correctly look up constants in a number of situations when you used module_eval and class_eval. module A BMacRuby = 10 Object.class_eval { B } endreduction.rb:3:in `block: uninitialized constantB (NameError)
    • Constant Lookup (in cRuby)
    • Constant Lookup (in cRuby)1: module A2: module B3: CONST = "B’s Const"4: module ::A5: p CONST6: end7: end8: end
    • Constant Lookup (in cRuby)1: module A2: module B3: CONST = "B’s Const"4: module ::A5: p CONST6: end7: end8: end
    • Constant Lookup (in cRuby)1: module A2: module B3: CONST = "B’s Const"4: module ::A5: p CONST6: end7: end8: end
    • Constant Lookup (in cRuby)1: module A2: module B3: CONST = "B’s Const"4: module ::A5: p CONST6: end7: end8: end
    • Constant Lookup (in cRuby)1: module A2: module B3: CONST = "B’s Const"4: module ::A5: p CONST6: end7: end8: end
    • Constant Lookup (in cRuby)1: module A2: module B3: CONST = "B’s Const"4: module ::A5: p CONST6: end7: end8: end
    • Constant Lookup (in cRuby)1: module A Lexical Scope2: module B3: CONST = "B’s Const"4: module ::A5: p CONST6: end7: end8: end
    • Constant Lookup (in cRuby)1: module A Lexical Scope2: module B3: CONST = "B’s Const"4: module ::A5: p CONST6: end Lookup7: end ons tant8: end exi L cal C
    • Constant Lookup (in "old" MacRuby)MacRuby had not implemented LexicalConstant Lookup.1: module A2: module B3: CONST = "B’s Const"4: module ::A5: p CONST6: end7: end8: end
    • Constant Lookup (in "old" MacRuby)MacRuby had not implemented LexicalConstant Lookup.1: module A2: module B3: MacRuby CONST = "B’s Const"4: module ::A5: p CONST6: end7: end8: end
    • Constant Lookup (in "old" MacRuby) MacRuby had not implemented Lexical Constant Lookup. 1: module A 2: module B 3: MacRuby CONST = "B’s Const" 4: module ::A 5: p CONST 6: end 7: end 8: end-e:5:in `block: uninitialized constant A::CONST (NameError)
    • Constant Lookup is complex (in cRuby)
    • Constant Lookup is complex (in cRuby) class_eval(&Block) class_eval(String)01: module A 01: module A02: CONST = "As CONST" 02: CONST = "As CONST"03: def f() 03: def f()04: class_eval { 04: class_eval <<-EOS05: p CONST 05: p CONST06: } 06: EOS07: end 07: end08: end 08: end09: 09:10: class K 10: class K11: CONST = "Ks CONST" 11: CONST = "Ks CONST"12: extend A 12: extend A13: f() 13: f()14: end 14: end
    • class_eval(&Block)01: module A02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A Lexical Scope02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: }07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(&Block)01: module A Lexical Scope02: CONST = "As CONST"03: def f()04: class_eval {05: p CONST06: } ON ST"07: end "As C08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(String)01: module A02: CONST = "As CONST"03: def f()04: class_eval <<-EOS05: p CONST06: EOS07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(String)01: module A02: CONST = "As CONST"03: def f()04: class_eval <<-EOS05: p CONST06: EOS07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(String)01: module A02: CONST = "As CONST"03: def f()04: class_eval <<-EOS05: p CONST06: EOS07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(String)01: module A02: CONST = "As CONST"03: def f()04: class_eval <<-EOS05: p CONST06: EOS07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(String)01: module A02: CONST = "As CONST"03: def f()04: class_eval <<-EOS05: p CONST06: EOS07: end08: end09:10: class K11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(String)01: module A02: CONST = "As CONST"03: def f()04: class_eval <<-EOS05: p CONST06: EOS07: end08: end09:10: class K Dynamic Scope11: CONST = "Ks CONST"12: extend A13: f()14: end
    • class_eval(String)01: module A02: CONST = "As CONST"03: def f()04: class_eval <<-EOS05: p CONST06: EOS07: end08: end09:10: class K Dynamic Scope11: CONST = "Ks CONST"12: extend A13: f() ON ST"14: end "Ks C
    • Constant Lookup is complex (in cRuby) class_eval(&Block) class_eval(String)01: module A Lexical Scope 01: module A02: CONST = "As CONST" 02: CONST = "As CONST"03: def f() 03: def f()04: class_eval { 04: class_eval <<-EOS05: p CONST 05: p CONST06: } ST" 06: EOS07: end "As CON 07: end08: end 08: end09: 09:10: class K 10: class K Dynamic Scope11: CONST = "Ks CONST" 11: CONST = "Ks CONST"12: extend A 12: extend A13: f() 13: f() ON ST"14: end 14: end " Ks C
    • I somehow managed to fix this (in MacRuby)
    • I somehow managed to fix this (in MacRuby)• Three attempts to get it right.
    • I somehow managed to fix this (in MacRuby)• Three attempts to get it right.• More than 3000 lines of code changed.
    • I somehow managed to fix this (in MacRuby)• Three attempts to get it right.• More than 3000 lines of code changed. 21 Apr 2011 15:24 Laurent S. its official, kouji is the hero of th e day/week/month/...? his patch seem s to fix remaining lexical const lookup bugs :)
    • A very complex bug (in "new" MacRuby)
    • A very complex bug (in "new" MacRuby)01: module A02: B = 4203: end04:05: A.class_eval do06: def self.f07: p B08: end09: end10:11: A.f
    • A very complex bug (in "new" MacRuby)01: module A02: B = 4203: end04:05: A.class_eval do06: def self.f07: p B08: end09: end10:11: A.f
    • A very complex bug (in "new" MacRuby)01: module A02: B = 4203: end04:05: A.class_eval do06: def self.f07: p B08: end09: end10:11: A.f
    • A very complex bug (in "new" MacRuby)01: module A02: B = 4203: end04:05: A.class_eval do06: def self.f07: p B08: end09: end10:11: A.f
    • A very complex bug (in "new" MacRuby)01: module A02: B = 4203: end04:05: A.class_eval do06: def self.f07: p B08: end09: end10:11: A.f
    • A very complex bug (in "new" MacRuby)01: module A02: B = 4203: end04:05: A.class_eval do06: def self.f07: p B08: end09: end10:11: A.f
    • A very complex bug (in "new" MacRuby)01: module A02: B = 4203: end04:05: A.class_eval do06: def self.f07: p B08: end09: end10:11: A.f
    • A very complex bug (in "new" MacRuby)01: module A02: B = 4203: end04: Lexical05: A.class_eval do06: def self.f07: p B08: end09: end10:11: A.f
    • A very complex bug (in "new" MacRuby)CAUTIONclass_eval does not add its own receiver 01: module A(A) 02: theBconstant lookup scope. to = 42 03: end 04: Lexical 05: A.class_eval do 06: def self.f 07: p B 08: end 09: end 10: 11: A.f
    • A very complex bug (in cRuby)01: module A02: B = 4203: end04:05: A.class_eval do06: def self.f07: p B08: end09: end10:11: A.f
    • A very complex bug (in cRuby)01: module A02: B = 42 end uby 1.903: R04: ➡4205: A.class_eval do06: def self.f07: p B08: end09: end10:11: A.f
    • A very complex bug (in cRuby) 01: module A 02: B = 42 03: end uby 1.9 R 04: ➡ 42 05: A.class_eval do 06: def self.f 07: p B eError) tB(Nam nstan 08: end 09: .8.7 1 end ialized coR u10: `f: uninit by -e :8:in➡11: A.f
    • A very complex bug (in cRuby) 01: module A 02: B = 42 03: end uby 1.9 R 04: A cR ➡ 42 ubys 05: A.class_eval do 06: def self.f ror) 07: 08: 09: .8.7 end Bug p B d constantB(NameErR 1 end u10: `f: uninit by ialize -e :8:in➡11: A.f
    • Demo$ rails new demo $ rails generate scaffold ... $ rails server
    • #1390 rb_vm_prepare_block➡ Abort if the "About your application’s environment" is link is clicked. CLICK! Assertion failed: ((b->flags & flags) == flags), function rb_vm_prepare_block, file dispatcher.cpp, line 1406. zsh: abort env VM_DISABLE_RBO=1 macruby -S rails server
    • The MacRuby train trip continues...
    • The MacRuby train trip continues...http://ww w.macrub y.org/
    • The MacRuby train trip continues... u by m acrhttp://ww @ w.macrub y.org/
    • The MacRuby train trip continues... u by m acrhttp://ww @ w.macrub y.org/ GitHub:MacRuby/MacRuby
    • The MacRuby train trip continues... u by m acr http://ww @ w.macrub y.org/ GitHub:MacRuby/MacRubymac ruby-devel@lists.macosforge.org
    • Conclusion
    • Conclusion• MacRuby ➡MacRuby is a unique blend of Ruby 1.9 and Objective-C. ➡The goal is to be 100% compatible with Ruby 1.9.
    • Conclusion• MacRuby ➡MacRuby is a unique blend of Ruby 1.9 and Objective-C. ➡The goal is to be 100% compatible with Ruby 1.9.• MacRuby on Rails ➡Were now able to show the default Rails welcome page. ➡But there is still a lot to do.
    • Acknowledgment
    • Acknowledgment• The RubyConf hosts and organizers
    • Acknowledgment• The RubyConf hosts and organizers• Tor Yamamoto-Sorensen (@shakaijin)
    • Acknowledgment• The RubyConf hosts and organizers• Tor Yamamoto-Sorensen (@shakaijin)• Everyone present today
    • Thank you
    • Q &A• If you have a question, please ask me, but if possible please speak slowly.• or contact @takaokouji_en by Twitter• or send e-mail to MacRuby ML