SlideShare une entreprise Scribd logo
1  sur  93
Télécharger pour lire hors ligne
MacRuby on Rails

                2011 3             MacRuby     Ruby                                    Ruby on Rails
                                                           MacRuby
                 Rails                                                              MacRuby     Rails
                                                                                                        cRuby



                Abstract

                MacRuby is an implementation of Ruby 1.9 that is 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 technical intricacies that I discovered along the way.




2011   7   19                                                                                                       1
•

                • cRuby             Readline

                • MacRuby

                • @takaokouji(@takaokouji_en)
                • http://facebook.com/takaokouji


2011   7   19                                      2
2011   7   19   3
•




2011   7   19       3
•
                    Network Applied Communicaiton Laboratory Co,.Ltd.




2011   7   19                                                           3
•
                    Network Applied Communicaiton Laboratory Co,.Ltd.

                •



2011   7   19                                                           3
•
                    Network Applied Communicaiton Laboratory Co,.Ltd.

                •



2011   7   19                                                           3
•
                    Network Applied Communicaiton Laboratory Co,.Ltd.

                •



2011   7   19                                                           3
MacRuby on Rails


2011   7   19                      4
MacRuby on Rails


2011   7   19                      4
MacRuby
                Mac OS X   Ruby




2011   7   19                     5
MacRuby




2011   7   19             6
MacRuby
                MacRuby is a unique blend of Ruby 1.9 and
                Objective-C.
                ➡ Ruby 1.9 Objective-C




2011   7   19                                               6
MacRuby
                MacRuby is a unique blend of Ruby 1.9 and
                Objective-C.
                ➡ Ruby 1.9 Objective-C

                The goal of the MacRuby project is to be
                100% compatible syntactically and
                behaviorally with Ruby 1.9.
                ➡ Ruby 1.9


2011   7   19                                               6
Ruby 1.9
                           Ruby 1.9


                Ruby VM
                                        GC




                             OS
                (Linux,Windows,Mac OS X,etc...)


2011   7   19                                     7
MacRuby
                          MacRuby


                Ruby VM
                                     GC




                          Mac OS X



2011   7   19                             8
MacRuby
                          MacRuby


                Ruby VM
                                     GC




                          Mac OS X



2011   7   19                             8
MacRuby
                          MacRuby


                Ruby VM
                                     AutoZone
                                     GC




                          Mac OS X



2011   7   19                                   8
MacRuby
                             MacRuby


                   Ruby VM
                                        AutoZone
                                        GC




            Foundation

                             Mac OS X



2011   7   19                                      8
MacRuby
                               MacRuby
                                               AutoZone

                        LLVM
                                          GC




                Foundation




                               Mac OS X



2011   7   19                                             9
MacRuby×Cocoa
                framework “cocoa”

                def playSound(name)
                 sound = NSSound.soundNamed(name)
                 sound.play
                end




2011   7   19                                       10
HelloMacRuby




2011   7   19                  11
HelloMacRuby




2011   7   19                  11
HelloMacRuby

                        Hello,MacRuby!



                Hello,MacRuby!




2011   7   19                            11
HelloMacRuby
                Ruby
                class AppController
                  attr_accessor :textField

                 def hello(sender)
                  @textField.stringValue = "Hello,MacRuby!"
                 end
                end




2011   7   19                                                 12
HelloMacRuby
                Ruby
                class AppController
                  attr_accessor :textField

                 def hello(sender)
                  @textField.stringValue = "Hello,MacRuby!"
                 end
                end




2011   7   19                                                 12
HelloMacRuby
                Ruby
                class AppController
                  attr_accessor :textField

                 def hello(sender)
                  @textField.stringValue = "Hello,MacRuby!"
                 end
                end




2011   7   19                                                 12
MacRuby on Rails
                MacRuby Ruby on Rails




2011   7   19                           13
MacRuby on Rails




2011   7   19                      14
MacRuby on Rails
                $ rails new demo




2011   7   19                             14
MacRuby on Rails
                $ rails new demo

                      $ rails generate scaffold ...




2011   7   19                                         14
MacRuby on Rails
                $ rails new demo

                      $ rails generate scaffold ...


                             $ rails server




2011   7   19                                         14
MacRuby on Rails
                $ rails new demo

                      $ rails generate scaffold ...


                             $ rails server




2011   7   19                                         14
4   ...




2011   7   19             15
4   ...
                2011   3




2011   7   19                        15
4      ...
                2011   3

                • MacRuby Rails




2011   7   19                           15
4                         ...
                2011      3

                • MacRuby Rails
                • Rails
                $ sudo macgem install --verbose rails --no-ri --no-rdoc
                7 gems installed

                $ sudo macgem install --verbose sqlite3-ruby --no-ri --no-rdoc
                2 gems installed



2011   7   19                                                                    15
...




2011   7   19         16
...
                •   Rails




2011   7   19                     16
...
                •              Rails

                •
                $ macruby -S rails new demo
                     create
                     create README
                     create Rakefile
                 ...
                     create vendor/plugins
                     create vendor/plugins/.gitkeep




2011   7   19                                               16
2011   7   19   17
• scaffold ...




2011   7   19                    17
• scaffold ...
                • abort
                $ macruby -S rails generate scaffold Bookmark title:string
                description:text url:string
                ...
                Assertion failed: ((size_t)pos < current_exceptions.size()),
                function pop_current_exception, file vm.cpp, line 3434.
                zsh: abort      macruby -S rails generate scaffold Bookmark
                title:string description:text




2011   7   19                                                                  17
• scaffold ...
                • abort
                $ macruby -S rails generate scaffold Bookmark title:string
                description:text url:string
                     $ macruby -S rails server
                ...
                     ...
                Assertion failed: ((size_t)pos < current_exceptions.size()),
                     Assertion failed: ((size_t)pos < current_exceptions.size()),
                function pop_current_exception, file vm.cpp, line 3434.
                     function pop_current_exception, file vm.cpp, line 3434.
                zsh: abort      macruby -S rails generate scaffold Bookmark
                     zsh: abort     macruby -S rails server
                title:string description:text




2011   7   19                                                                       17
Rails

                SEGV    abort




                 RubySpec

                Rails
2011   7   19                   18
Rails

                SEGV    abort
                                •   cRuby
                                •   Objective-C
                                •   C++
                                •   LLVM
                 RubySpec

                Rails
2011   7   19                                     18
#860 catch/throw
                Assertion fails in pop_current_exception
                when catch/throw used in rescue
                ➡ rescue     catch throw      abort




2011   7   19                                              19
#860 catch/throw
                Assertion fails in pop_current_exception
                when catch/throw used in rescue
                ➡ rescue            catch throw           abort

                begin
                 raise
                rescue
                 catch(:ambiguous) { throw :ambiguous }
                 p :ok
                end




2011   7   19                                                     19
#860 catch/throw
                Assertion fails in pop_current_exception
                when catch/throw used in rescue
                ➡ rescue              catch throw               abort

                begin
                 raise
                rescue
                 catch(:ambiguous) { throw :ambiguous }
                 p :ok
                end

                :ok
                Assertion failed: ((size_t)pos < current_exceptions.size()),
                function pop_current_exception, file vm.cpp, line 3448.

2011   7   19                                                                  19
#860 catch/throw
                Assertion fails in pop_current_exception
                when catch/throw used in rescue
                ➡ rescue              catch throw               abort
                                                 throw
                begin
                 raise
                rescue
                 catch(:ambiguous) { throw :ambiguous }
                 p :ok
                end

                :ok
                Assertion failed: ((size_t)pos < current_exceptions.size()),
                function pop_current_exception, file vm.cpp, line 3448.

2011   7   19                                                                  19
#860 catch/throw
                Assertion fails in pop_current_exception
                when catch/throw used in rescue
                ➡ rescue              catch throw               abort
                                                 throw
                begin
                 raise
                rescue
                 catch(:ambiguous) { throw :ambiguous }
                 p :ok
                end

                :ok                             abort
                Assertion failed: ((size_t)pos < current_exceptions.size()),
                function pop_current_exception, file vm.cpp, line 3448.

2011   7   19                                                                  19
#860 catch/throw
                 (60723bf~)   throw




2011   7   19                         20
#860 catch/throw
                          (60723bf~)   throw


                catch(:ambiguous) {
                  begin
                   raise
                  rescue
                   throw :ambiguou
                  end
                }




2011   7   19                                  20
#860 catch/throw
                          (60723bf~)   throw


                catch(:ambiguous) {
                  begin
                   raise
                  rescue
                   throw :ambiguou
                  end
                }                          end




2011   7   19                                    20
#860 catch/throw
                          (60723bf~)          throw


                catch(:ambiguous) {
                  begin               throw
                   raise
                  rescue
                   throw :ambiguou
                  end
                }                                 end




2011   7   19                                           20
#860 catch/throw
                               (60723bf~)                  throw


                vm.cpp:4321:
                     catch(:ambiguous) {
                VALUE  begin                   throw
                RoxorVM::ruby_throw(VALUE tag,VALUE value)
                         raise
                {      rescue
                ...      throw :ambiguou
                    // end must pop the current VM exception in case we are in a rescue handler,
                       We
                    // since we are going to unwind the stack.
                     }                                              end
                    if (current_exception() != Qnil) {
                	

 pop_current_exception();
                    }
                ...

2011   7   19                                                                                      20
#860 catch/throw
                ➡
                     (60723bf)




2011   7   19                          21
#860 catch/throw
                  ➡
                             (60723bf)
                vm.cpp:4318:
                VALUE
                RoxorVM::ruby_throw(VALUE tag,VALUE value)
                {
                ...
                    rb_vm_catch_t *catch_ptr = iter->second;
                    while (catch_ptr->current_exception != current_exception()) {
                	

 pop_current_exception();
                    }
                ...



2011   7   19                                                                       21
#860 catch/throw
                  ➡
                             (60723bf)
                                 catch                    (catch_ptr->current_exception)
                vm.cpp:4318:
                VALUE                         (current_exception())
                RoxorVM::ruby_throw(VALUE tag,VALUE value)
                {
                ...
                    rb_vm_catch_t *catch_ptr = iter->second;
                    while (catch_ptr->current_exception != current_exception()) {
                	

 pop_current_exception();
                    }
                ...



2011   7   19                                                                              21
#860 catch/throw
                begin
                 raise
                rescue
                 catch(:ambiguous) {
                   begin
                    raise
                   rescue
                    begin
                      raise
                    rescue
                      throw :ambiguous
                    end
                   end
                 }
                 p :ok
                end


2011   7   19                             22
#860 catch/throw
                begin          A
                 raise
                rescue
                 catch(:ambiguous) {
                   begin
                    raise
                   rescue
                    begin
                      raise
                    rescue
                      throw :ambiguous
                    end
                   end
                 }
                 p :ok
                end


2011   7   19                             22
#860 catch/throw
                begin          A
                 raise                        A
                rescue                   catch_ptr->current_exception = current_exception();
                 catch(:ambiguous) {
                   begin
                    raise
                   rescue
                    begin
                      raise
                    rescue
                      throw :ambiguous
                    end
                   end
                 }
                 p :ok
                end


2011   7   19                                                                                  22
#860 catch/throw
                begin          A
                 raise                        A
                rescue                   catch_ptr->current_exception = current_exception();
                 catch(:ambiguous) {
                   begin         B
                    raise
                   rescue
                    begin
                      raise
                    rescue
                      throw :ambiguous
                    end
                   end
                 }
                 p :ok
                end


2011   7   19                                                                                  22
#860 catch/throw
                begin          A
                 raise                        A
                rescue                   catch_ptr->current_exception = current_exception();
                 catch(:ambiguous) {
                   begin         B
                    raise
                   rescue
                    begin          C
                      raise
                    rescue
                      throw :ambiguous
                    end
                   end
                 }
                 p :ok
                end


2011   7   19                                                                                  22
#860 catch/throw
                begin          A
                 raise                        A
                rescue                   catch_ptr->current_exception = current_exception();
                 catch(:ambiguous) {
                   begin         B
                    raise
                   rescue
                    begin          C
                      raise
                    rescue                     C    B A                                        A
                      throw :ambiguous
                                                               C    B
                    end
                   end
                 }
                 p :ok
                end


2011   7   19                                                                                      22
#860 catch/throw
                begin           A
                 raise                        A
                rescue                   catch_ptr->current_exception = current_exception();
                 catch(:ambiguous) {
                   begin          B
                    raise
                   rescue
                    begin           C
                      raise
                    rescue                     C    B A                                        A
                      throw :ambiguous
                                                               C    B
                    end
                   end
                 }
                 p :ok        A
                end


2011   7   19                                                                                      22
#1192
                Did not find nested constants.
                ➡




2011   7   19                                   23
#1192
                Did not find nested constants.
                ➡
                module A
                 B = 10
                 Object.class_eval { B }
                end




2011   7   19                                   23
#1192
                Did not find nested constants.
                ➡
                module A
                 B = 10
                 Object.class_eval { B }
                end


                reduction.rb:3:in `block': uninitialized constant B (NameError)
                     from reduction.rb:1:in `<main>'




2011   7   19                                                                     23
#1192
                Did not find nested constants.
                ➡
                module A
                                              Object         B
                 B = 10
                 Object.class_eval { B }
                end


                reduction.rb:3:in `block': uninitialized constant B (NameError)
                     from reduction.rb:1:in `<main>'




2011   7   19                                                                     23
#1192
                  6b101bd~




2011   7   19                24
#1192
                            6b101bd~


                module A
                 module B
                  CONST = “B’s Const”
                    module ::A
                     p CONST
                    end
                 end
                end




2011   7   19                           24
#1192
                              6b101bd~


                module A
                 module B
                  CONST = “B’s Const”
                    module ::A
                     p CONST
                    end
                 end
                end

                -e:5:in `block': uninitialized constant A::CONST (NameError)


2011   7   19                                                                  24
#1192
                              6b101bd~


                module A
                 module B
                  CONST = “B’s Const”
                    module ::A
                     p CONST          ::A A::B A
                    end                       ::A
                 end
                end

                -e:5:in `block': uninitialized constant A::CONST (NameError)


2011   7   19                                                                  24
module_eval(            )   module_eval
                module A                    module A
                 CONST = "A's CONST"         CONST = "A's CONST"
                 def f                       def f
                  class_eval <<-EOS           class_eval {
                    p CONST                     p CONST
                  EOS                         }
                 end                         end
                end                         end

                class K                     class K
                  CONST = "K's CONST"         CONST = "K's CONST"
                  extend A                    extend A
                  f                           f
                end                         end

2011   7   19                                                       25
module_eval(            )    module_eval
                module A                     module A
                 CONST = "A's CONST"          CONST = "A's CONST"
                 def f                        def f
                  class_eval <<-EOS            class_eval {
                    p CONST                      p CONST
                  EOS      #=> "K's CONST"     }
                 end                          end
                end                          end

                class K                      class K
                  CONST = "K's CONST"          CONST = "K's CONST"
                  extend A                     extend A
                  f                            f
                end                          end

2011   7   19                                                        25
module_eval(            )    module_eval
                module A                     module A
                 CONST = "A's CONST"          CONST = "A's CONST"
                 def f                        def f
                  class_eval <<-EOS            class_eval {
                    p CONST                      p CONST
                  EOS      #=> "K's CONST"     }       #=> "A's CONST"
                 end                          end
                end                          end

                class K                      class K
                  CONST = "K's CONST"          CONST = "K's CONST"
                  extend A                     extend A
                  f                            f
                end                          end

2011   7   19                                                            25
module_eval(            )    module_eval
                module A                     module A
                 CONST = "A's CONST"          CONST = "A's CONST"
                 def f                        def f
                  class_eval <<-EOS            class_eval {
                    p CONST                      p CONST
                  EOS      #=> "K's CONST"     }       #=> "A's CONST"
                 end       K A Object         end
                end           CONST
                                             end

                class K                      class K
                  CONST = "K's CONST"          CONST = "K's CONST"
                  extend A                     extend A
                  f                            f
                end                          end

2011   7   19                                                            25
module_eval(            )    module_eval
                module A                     module A
                 CONST = "A's CONST"          CONST = "A's CONST"
                 def f                        def f
                  class_eval <<-EOS            class_eval {
                    p CONST                      p CONST
                  EOS      #=> "K's CONST"     }       #=> "A's CONST"
                 end       K A Object         end       A Object
                end           CONST
                                             end            CONST
                                                      K
                class K                      class K
                  CONST = "K's CONST"          CONST = "K's CONST"
                  extend A                     extend A
                  f                            f
                end                          end

2011   7   19                                                            25
2011   7   19   26
module A
                 B = 42
                end

                A.class_eval do
                 def self.f
                  pB
                 end
                end

                A.f


2011   7   19                     26
module A
                 B = 42
                                  Ruby 1.9
                end               42

                A.class_eval do
                 def self.f
                  pB
                 end
                end

                A.f


2011   7   19                                26
module A
                 B = 42
                                  Ruby 1.9
                end               42

                A.class_eval do
                 def self.f       Ruby 1.8.7
                                  -e:8:in `f': uninitialized constant B (NameError)
                  pB
                 end
                end

                A.f


2011   7   19                                                                         26
module A
                 B = 42

                                  y
                                  Ruby 1.9
                end

                                 b
                                  42


                 def self.f
                  pB
                              R
                A.class_eval do

                            c   u Ruby 1.8.7
                                  -e:8:in `f': uninitialized constant B (NameError)
                 end
                end

                A.f


2011   7   19                                                                         26
#
                abort when I pressed “About your
                application’s environment” in welcome page.
                ➡ Welcome aboard
                    abort




2011   7   19                                                 27
#
                abort when I pressed “About your
                application’s environment” in welcome page.
                ➡ Welcome aboard
                    abort




2011   7   19                                                 27
#
                abort when I pressed “About your
                application’s environment” in welcome page.
                ➡ Welcome aboard
                    abort




2011   7   19                                                 27
#
                abort when I pressed “About your
                application’s environment” in welcome page.
                ➡ Welcome aboard
                      abort




                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


2011   7   19                                                                 27
...




2011   7   19         28
...
                MacRuby Rails         ...




2011   7   19                               28
...
                MacRuby Rails         ...

                ➡




2011   7   19                               28
...
                MacRuby Rails                       ...

                ➡

                ➡ @lrz
                    Rails       MacRuby 1.0




2011   7   19                                             28
RubyConf ...




                 To be continued...
                             <morohoshi@netlab.jp>




2011   7   19                                        29

Contenu connexe

Similaire à MacRuby on Rails

RubyならMacでしょう
RubyならMacでしょうRubyならMacでしょう
RubyならMacでしょうvincentisambart
 
GUI Programming with MacRuby
GUI Programming with MacRubyGUI Programming with MacRuby
GUI Programming with MacRubyErik Berlin
 
Developing Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyDeveloping Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyBrendan Lim
 
Welcome To Ruby On Rails
Welcome To Ruby On RailsWelcome To Ruby On Rails
Welcome To Ruby On RailsKevin Lawver
 
Bay Area Drupal Camp Efficiency
Bay Area Drupal Camp EfficiencyBay Area Drupal Camp Efficiency
Bay Area Drupal Camp Efficiencysmattoon
 
MacRuby for Fun and Profit
MacRuby for Fun and ProfitMacRuby for Fun and Profit
MacRuby for Fun and ProfitJoshua Ballanco
 
11月8日イケテルjruby勉強会@東京
11月8日イケテルjruby勉強会@東京11月8日イケテルjruby勉強会@東京
11月8日イケテルjruby勉強会@東京mochiko AsTech
 
Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)Tobias Pfeiffer
 
Ruby on Rails : First Mile
Ruby on Rails : First MileRuby on Rails : First Mile
Ruby on Rails : First MileGourab Mitra
 
Bitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRubyBitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRubyBrian Sam-Bodden
 
Macruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich KilmerMacruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich KilmerMatt Aimonetti
 
Ruby Meets Cocoa
Ruby Meets CocoaRuby Meets Cocoa
Ruby Meets CocoaRobbert
 
Improving your workflow with RubyMotion
Improving your workflow with RubyMotionImproving your workflow with RubyMotion
Improving your workflow with RubyMotionMark Villacampa
 
Upcoming Rails 7 Features.pdf
Upcoming Rails 7 Features.pdfUpcoming Rails 7 Features.pdf
Upcoming Rails 7 Features.pdfBluebash LLC
 

Similaire à MacRuby on Rails (20)

RubyならMacでしょう
RubyならMacでしょうRubyならMacでしょう
RubyならMacでしょう
 
GUI Programming with MacRuby
GUI Programming with MacRubyGUI Programming with MacRuby
GUI Programming with MacRuby
 
MacRuby on Rails
MacRuby on RailsMacRuby on Rails
MacRuby on Rails
 
Developing Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyDeveloping Cocoa Applications with macRuby
Developing Cocoa Applications with macRuby
 
Welcome To Ruby On Rails
Welcome To Ruby On RailsWelcome To Ruby On Rails
Welcome To Ruby On Rails
 
Bay Area Drupal Camp Efficiency
Bay Area Drupal Camp EfficiencyBay Area Drupal Camp Efficiency
Bay Area Drupal Camp Efficiency
 
Web application intro
Web application introWeb application intro
Web application intro
 
MacRuby for Fun and Profit
MacRuby for Fun and ProfitMacRuby for Fun and Profit
MacRuby for Fun and Profit
 
11月8日イケテルjruby勉強会@東京
11月8日イケテルjruby勉強会@東京11月8日イケテルjruby勉強会@東京
11月8日イケテルjruby勉強会@東京
 
Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)
 
Ruby on Rails : First Mile
Ruby on Rails : First MileRuby on Rails : First Mile
Ruby on Rails : First Mile
 
Concurrency in ruby
Concurrency in rubyConcurrency in ruby
Concurrency in ruby
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 
Bitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRubyBitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRuby
 
MacRuby, an introduction
MacRuby, an introductionMacRuby, an introduction
MacRuby, an introduction
 
Macruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich KilmerMacruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich Kilmer
 
Ruby Meets Cocoa
Ruby Meets CocoaRuby Meets Cocoa
Ruby Meets Cocoa
 
Improving your workflow with RubyMotion
Improving your workflow with RubyMotionImproving your workflow with RubyMotion
Improving your workflow with RubyMotion
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009
 
Upcoming Rails 7 Features.pdf
Upcoming Rails 7 Features.pdfUpcoming Rails 7 Features.pdf
Upcoming Rails 7 Features.pdf
 

Plus de 宏治 高尾

Smalruby - The neat thing to connect Rubyists and Scratchers -
Smalruby - The neat thing to connect Rubyists and Scratchers -Smalruby - The neat thing to connect Rubyists and Scratchers -
Smalruby - The neat thing to connect Rubyists and Scratchers -宏治 高尾
 
小学生3年生から使えるRubyのビジュアルプログラミングエディタ「スモウルビー」と、それを活用した任意団体「Rubyプログラミング少年団」[第7回フクオカ...
小学生3年生から使えるRubyのビジュアルプログラミングエディタ「スモウルビー」と、それを活用した任意団体「Rubyプログラミング少年団」[第7回フクオカ...小学生3年生から使えるRubyのビジュアルプログラミングエディタ「スモウルビー」と、それを活用した任意団体「Rubyプログラミング少年団」[第7回フクオカ...
小学生3年生から使えるRubyのビジュアルプログラミングエディタ「スモウルビー」と、それを活用した任意団体「Rubyプログラミング少年団」[第7回フクオカ...宏治 高尾
 
(final version) KIDS, RUBY, FUN! - Introduction of the Smalruby and Ruby Pro...
(final version) KIDS, RUBY, FUN! - Introduction of the Smalruby and RubyPro...(final version) KIDS, RUBY, FUN! - Introduction of the Smalruby and RubyPro...
(final version) KIDS, RUBY, FUN! - Introduction of the Smalruby and Ruby Pro...宏治 高尾
 
(beta version) KIDS, RUBY, FUN! - Introduction of the Smalruby and Ruby Prog...
(beta version) KIDS, RUBY, FUN! - Introduction of the Smalruby and RubyProg...(beta version) KIDS, RUBY, FUN! - Introduction of the Smalruby and RubyProg...
(beta version) KIDS, RUBY, FUN! - Introduction of the Smalruby and Ruby Prog...宏治 高尾
 
Kids, Ruby, Fun! ぼくたち、 Rubyプログラミング少年団! 〜小学生からはじめる Ruby プログラミング〜
Kids,Ruby,Fun! ぼくたち、 Rubyプログラミング少年団! 〜小学生からはじめる Ruby プログラミング〜Kids,Ruby,Fun! ぼくたち、 Rubyプログラミング少年団! 〜小学生からはじめる Ruby プログラミング〜
Kids, Ruby, Fun! ぼくたち、 Rubyプログラミング少年団! 〜小学生からはじめる Ruby プログラミング〜宏治 高尾
 
Kids, Ruby, Run! - Introduction of the Smalruby and the Ruby Programming Shou...
Kids, Ruby, Run! - Introduction of the Smalruby and the Ruby Programming Shou...Kids, Ruby, Run! - Introduction of the Smalruby and the Ruby Programming Shou...
Kids, Ruby, Run! - Introduction of the Smalruby and the Ruby Programming Shou...宏治 高尾
 
ぼくたちRubyプログラミング少年団!~小・中学生向けプログラミング言語Rubyの学習塾の運営、学習教材の開発・販売事業~
ぼくたちRubyプログラミング少年団!~小・中学生向けプログラミング言語Rubyの学習塾の運営、学習教材の開発・販売事業~ぼくたちRubyプログラミング少年団!~小・中学生向けプログラミング言語Rubyの学習塾の運営、学習教材の開発・販売事業~
ぼくたちRubyプログラミング少年団!~小・中学生向けプログラミング言語Rubyの学習塾の運営、学習教材の開発・販売事業~宏治 高尾
 
勉強会をはじめよう
勉強会をはじめよう勉強会をはじめよう
勉強会をはじめよう宏治 高尾
 
Mac Rubyではじめる!Macアプリ開発入門
Mac Rubyではじめる!Macアプリ開発入門Mac Rubyではじめる!Macアプリ開発入門
Mac Rubyではじめる!Macアプリ開発入門宏治 高尾
 
RubyによるMac OS Xデスクトップアプリケーション開発入門--Snow Leopard対応版
RubyによるMac OS Xデスクトップアプリケーション開発入門--Snow Leopard対応版RubyによるMac OS Xデスクトップアプリケーション開発入門--Snow Leopard対応版
RubyによるMac OS Xデスクトップアプリケーション開発入門--Snow Leopard対応版宏治 高尾
 
RubyによるMac OS Xデスクトップアプリケーション開発入門
RubyによるMac OS Xデスクトップアプリケーション開発入門RubyによるMac OS Xデスクトップアプリケーション開発入門
RubyによるMac OS Xデスクトップアプリケーション開発入門宏治 高尾
 

Plus de 宏治 高尾 (11)

Smalruby - The neat thing to connect Rubyists and Scratchers -
Smalruby - The neat thing to connect Rubyists and Scratchers -Smalruby - The neat thing to connect Rubyists and Scratchers -
Smalruby - The neat thing to connect Rubyists and Scratchers -
 
小学生3年生から使えるRubyのビジュアルプログラミングエディタ「スモウルビー」と、それを活用した任意団体「Rubyプログラミング少年団」[第7回フクオカ...
小学生3年生から使えるRubyのビジュアルプログラミングエディタ「スモウルビー」と、それを活用した任意団体「Rubyプログラミング少年団」[第7回フクオカ...小学生3年生から使えるRubyのビジュアルプログラミングエディタ「スモウルビー」と、それを活用した任意団体「Rubyプログラミング少年団」[第7回フクオカ...
小学生3年生から使えるRubyのビジュアルプログラミングエディタ「スモウルビー」と、それを活用した任意団体「Rubyプログラミング少年団」[第7回フクオカ...
 
(final version) KIDS, RUBY, FUN! - Introduction of the Smalruby and Ruby Pro...
(final version) KIDS, RUBY, FUN! - Introduction of the Smalruby and RubyPro...(final version) KIDS, RUBY, FUN! - Introduction of the Smalruby and RubyPro...
(final version) KIDS, RUBY, FUN! - Introduction of the Smalruby and Ruby Pro...
 
(beta version) KIDS, RUBY, FUN! - Introduction of the Smalruby and Ruby Prog...
(beta version) KIDS, RUBY, FUN! - Introduction of the Smalruby and RubyProg...(beta version) KIDS, RUBY, FUN! - Introduction of the Smalruby and RubyProg...
(beta version) KIDS, RUBY, FUN! - Introduction of the Smalruby and Ruby Prog...
 
Kids, Ruby, Fun! ぼくたち、 Rubyプログラミング少年団! 〜小学生からはじめる Ruby プログラミング〜
Kids,Ruby,Fun! ぼくたち、 Rubyプログラミング少年団! 〜小学生からはじめる Ruby プログラミング〜Kids,Ruby,Fun! ぼくたち、 Rubyプログラミング少年団! 〜小学生からはじめる Ruby プログラミング〜
Kids, Ruby, Fun! ぼくたち、 Rubyプログラミング少年団! 〜小学生からはじめる Ruby プログラミング〜
 
Kids, Ruby, Run! - Introduction of the Smalruby and the Ruby Programming Shou...
Kids, Ruby, Run! - Introduction of the Smalruby and the Ruby Programming Shou...Kids, Ruby, Run! - Introduction of the Smalruby and the Ruby Programming Shou...
Kids, Ruby, Run! - Introduction of the Smalruby and the Ruby Programming Shou...
 
ぼくたちRubyプログラミング少年団!~小・中学生向けプログラミング言語Rubyの学習塾の運営、学習教材の開発・販売事業~
ぼくたちRubyプログラミング少年団!~小・中学生向けプログラミング言語Rubyの学習塾の運営、学習教材の開発・販売事業~ぼくたちRubyプログラミング少年団!~小・中学生向けプログラミング言語Rubyの学習塾の運営、学習教材の開発・販売事業~
ぼくたちRubyプログラミング少年団!~小・中学生向けプログラミング言語Rubyの学習塾の運営、学習教材の開発・販売事業~
 
勉強会をはじめよう
勉強会をはじめよう勉強会をはじめよう
勉強会をはじめよう
 
Mac Rubyではじめる!Macアプリ開発入門
Mac Rubyではじめる!Macアプリ開発入門Mac Rubyではじめる!Macアプリ開発入門
Mac Rubyではじめる!Macアプリ開発入門
 
RubyによるMac OS Xデスクトップアプリケーション開発入門--Snow Leopard対応版
RubyによるMac OS Xデスクトップアプリケーション開発入門--Snow Leopard対応版RubyによるMac OS Xデスクトップアプリケーション開発入門--Snow Leopard対応版
RubyによるMac OS Xデスクトップアプリケーション開発入門--Snow Leopard対応版
 
RubyによるMac OS Xデスクトップアプリケーション開発入門
RubyによるMac OS Xデスクトップアプリケーション開発入門RubyによるMac OS Xデスクトップアプリケーション開発入門
RubyによるMac OS Xデスクトップアプリケーション開発入門
 

Dernier

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 Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
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
 
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
 
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
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
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
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 

Dernier (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
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
 
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
 
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...
 
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...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 

MacRuby on Rails

  • 1. MacRuby on Rails 2011 3 MacRuby Ruby Ruby on Rails MacRuby Rails MacRuby Rails cRuby Abstract MacRuby is an implementation of Ruby 1.9 that is 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 technical intricacies that I discovered along the way. 2011 7 19 1
  • 2. • cRuby Readline • MacRuby • @takaokouji(@takaokouji_en) • http://facebook.com/takaokouji 2011 7 19 2
  • 3. 2011 7 19 3
  • 4. • 2011 7 19 3
  • 5. Network Applied Communicaiton Laboratory Co,.Ltd. 2011 7 19 3
  • 6. Network Applied Communicaiton Laboratory Co,.Ltd. • 2011 7 19 3
  • 7. Network Applied Communicaiton Laboratory Co,.Ltd. • 2011 7 19 3
  • 8. Network Applied Communicaiton Laboratory Co,.Ltd. • 2011 7 19 3
  • 11. MacRuby Mac OS X Ruby 2011 7 19 5
  • 12. MacRuby 2011 7 19 6
  • 13. MacRuby MacRuby is a unique blend of Ruby 1.9 and Objective-C. ➡ Ruby 1.9 Objective-C 2011 7 19 6
  • 14. MacRuby MacRuby is a unique blend of Ruby 1.9 and Objective-C. ➡ Ruby 1.9 Objective-C The goal of the MacRuby project is to be 100% compatible syntactically and behaviorally with Ruby 1.9. ➡ Ruby 1.9 2011 7 19 6
  • 15. Ruby 1.9 Ruby 1.9 Ruby VM GC OS (Linux,Windows,Mac OS X,etc...) 2011 7 19 7
  • 16. MacRuby MacRuby Ruby VM GC Mac OS X 2011 7 19 8
  • 17. MacRuby MacRuby Ruby VM GC Mac OS X 2011 7 19 8
  • 18. MacRuby MacRuby Ruby VM AutoZone GC Mac OS X 2011 7 19 8
  • 19. MacRuby MacRuby Ruby VM AutoZone GC Foundation Mac OS X 2011 7 19 8
  • 20. MacRuby MacRuby AutoZone LLVM GC Foundation Mac OS X 2011 7 19 9
  • 21. MacRuby×Cocoa framework “cocoa” def playSound(name) sound = NSSound.soundNamed(name) sound.play end 2011 7 19 10
  • 22. HelloMacRuby 2011 7 19 11
  • 23. HelloMacRuby 2011 7 19 11
  • 24. HelloMacRuby Hello,MacRuby! Hello,MacRuby! 2011 7 19 11
  • 25. HelloMacRuby Ruby class AppController attr_accessor :textField def hello(sender) @textField.stringValue = "Hello,MacRuby!" end end 2011 7 19 12
  • 26. HelloMacRuby Ruby class AppController attr_accessor :textField def hello(sender) @textField.stringValue = "Hello,MacRuby!" end end 2011 7 19 12
  • 27. HelloMacRuby Ruby class AppController attr_accessor :textField def hello(sender) @textField.stringValue = "Hello,MacRuby!" end end 2011 7 19 12
  • 28. MacRuby on Rails MacRuby Ruby on Rails 2011 7 19 13
  • 30. MacRuby on Rails $ rails new demo 2011 7 19 14
  • 31. MacRuby on Rails $ rails new demo $ rails generate scaffold ... 2011 7 19 14
  • 32. MacRuby on Rails $ rails new demo $ rails generate scaffold ... $ rails server 2011 7 19 14
  • 33. MacRuby on Rails $ rails new demo $ rails generate scaffold ... $ rails server 2011 7 19 14
  • 34. 4 ... 2011 7 19 15
  • 35. 4 ... 2011 3 2011 7 19 15
  • 36. 4 ... 2011 3 • MacRuby Rails 2011 7 19 15
  • 37. 4 ... 2011 3 • MacRuby Rails • Rails $ sudo macgem install --verbose rails --no-ri --no-rdoc 7 gems installed $ sudo macgem install --verbose sqlite3-ruby --no-ri --no-rdoc 2 gems installed 2011 7 19 15
  • 38. ... 2011 7 19 16
  • 39. ... • Rails 2011 7 19 16
  • 40. ... • Rails • $ macruby -S rails new demo create create README create Rakefile ... create vendor/plugins create vendor/plugins/.gitkeep 2011 7 19 16
  • 41. 2011 7 19 17
  • 43. • scaffold ... • abort $ macruby -S rails generate scaffold Bookmark title:string description:text url:string ... Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3434. zsh: abort macruby -S rails generate scaffold Bookmark title:string description:text 2011 7 19 17
  • 44. • scaffold ... • abort $ macruby -S rails generate scaffold Bookmark title:string description:text url:string $ macruby -S rails server ... ... Assertion failed: ((size_t)pos < current_exceptions.size()), Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3434. function pop_current_exception, file vm.cpp, line 3434. zsh: abort macruby -S rails generate scaffold Bookmark zsh: abort macruby -S rails server title:string description:text 2011 7 19 17
  • 45. Rails SEGV abort RubySpec Rails 2011 7 19 18
  • 46. Rails SEGV abort • cRuby • Objective-C • C++ • LLVM RubySpec Rails 2011 7 19 18
  • 47. #860 catch/throw Assertion fails in pop_current_exception when catch/throw used in rescue ➡ rescue catch throw abort 2011 7 19 19
  • 48. #860 catch/throw Assertion fails in pop_current_exception when catch/throw used in rescue ➡ rescue catch throw abort begin raise rescue catch(:ambiguous) { throw :ambiguous } p :ok end 2011 7 19 19
  • 49. #860 catch/throw Assertion fails in pop_current_exception when catch/throw used in rescue ➡ rescue catch throw abort begin raise rescue catch(:ambiguous) { throw :ambiguous } p :ok end :ok Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3448. 2011 7 19 19
  • 50. #860 catch/throw Assertion fails in pop_current_exception when catch/throw used in rescue ➡ rescue catch throw abort throw begin raise rescue catch(:ambiguous) { throw :ambiguous } p :ok end :ok Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3448. 2011 7 19 19
  • 51. #860 catch/throw Assertion fails in pop_current_exception when catch/throw used in rescue ➡ rescue catch throw abort throw begin raise rescue catch(:ambiguous) { throw :ambiguous } p :ok end :ok abort Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3448. 2011 7 19 19
  • 52. #860 catch/throw (60723bf~) throw 2011 7 19 20
  • 53. #860 catch/throw (60723bf~) throw catch(:ambiguous) { begin raise rescue throw :ambiguou end } 2011 7 19 20
  • 54. #860 catch/throw (60723bf~) throw catch(:ambiguous) { begin raise rescue throw :ambiguou end } end 2011 7 19 20
  • 55. #860 catch/throw (60723bf~) throw catch(:ambiguous) { begin throw raise rescue throw :ambiguou end } end 2011 7 19 20
  • 56. #860 catch/throw (60723bf~) throw vm.cpp:4321: catch(:ambiguous) { VALUE begin throw RoxorVM::ruby_throw(VALUE tag,VALUE value) raise { rescue ... throw :ambiguou // end must pop the current VM exception in case we are in a rescue handler, We // since we are going to unwind the stack. } end if (current_exception() != Qnil) { pop_current_exception(); } ... 2011 7 19 20
  • 57. #860 catch/throw ➡ (60723bf) 2011 7 19 21
  • 58. #860 catch/throw ➡ (60723bf) vm.cpp:4318: VALUE RoxorVM::ruby_throw(VALUE tag,VALUE value) { ... rb_vm_catch_t *catch_ptr = iter->second; while (catch_ptr->current_exception != current_exception()) { pop_current_exception(); } ... 2011 7 19 21
  • 59. #860 catch/throw ➡ (60723bf) catch (catch_ptr->current_exception) vm.cpp:4318: VALUE (current_exception()) RoxorVM::ruby_throw(VALUE tag,VALUE value) { ... rb_vm_catch_t *catch_ptr = iter->second; while (catch_ptr->current_exception != current_exception()) { pop_current_exception(); } ... 2011 7 19 21
  • 60. #860 catch/throw begin raise rescue catch(:ambiguous) { begin raise rescue begin raise rescue throw :ambiguous end end } p :ok end 2011 7 19 22
  • 61. #860 catch/throw begin A raise rescue catch(:ambiguous) { begin raise rescue begin raise rescue throw :ambiguous end end } p :ok end 2011 7 19 22
  • 62. #860 catch/throw begin A raise A rescue catch_ptr->current_exception = current_exception(); catch(:ambiguous) { begin raise rescue begin raise rescue throw :ambiguous end end } p :ok end 2011 7 19 22
  • 63. #860 catch/throw begin A raise A rescue catch_ptr->current_exception = current_exception(); catch(:ambiguous) { begin B raise rescue begin raise rescue throw :ambiguous end end } p :ok end 2011 7 19 22
  • 64. #860 catch/throw begin A raise A rescue catch_ptr->current_exception = current_exception(); catch(:ambiguous) { begin B raise rescue begin C raise rescue throw :ambiguous end end } p :ok end 2011 7 19 22
  • 65. #860 catch/throw begin A raise A rescue catch_ptr->current_exception = current_exception(); catch(:ambiguous) { begin B raise rescue begin C raise rescue C B A A throw :ambiguous C B end end } p :ok end 2011 7 19 22
  • 66. #860 catch/throw begin A raise A rescue catch_ptr->current_exception = current_exception(); catch(:ambiguous) { begin B raise rescue begin C raise rescue C B A A throw :ambiguous C B end end } p :ok A end 2011 7 19 22
  • 67. #1192 Did not find nested constants. ➡ 2011 7 19 23
  • 68. #1192 Did not find nested constants. ➡ module A B = 10 Object.class_eval { B } end 2011 7 19 23
  • 69. #1192 Did not find nested constants. ➡ module A B = 10 Object.class_eval { B } end reduction.rb:3:in `block': uninitialized constant B (NameError) from reduction.rb:1:in `<main>' 2011 7 19 23
  • 70. #1192 Did not find nested constants. ➡ module A Object B B = 10 Object.class_eval { B } end reduction.rb:3:in `block': uninitialized constant B (NameError) from reduction.rb:1:in `<main>' 2011 7 19 23
  • 71. #1192 6b101bd~ 2011 7 19 24
  • 72. #1192 6b101bd~ module A module B CONST = “B’s Const” module ::A p CONST end end end 2011 7 19 24
  • 73. #1192 6b101bd~ module A module B CONST = “B’s Const” module ::A p CONST end end end -e:5:in `block': uninitialized constant A::CONST (NameError) 2011 7 19 24
  • 74. #1192 6b101bd~ module A module B CONST = “B’s Const” module ::A p CONST ::A A::B A end ::A end end -e:5:in `block': uninitialized constant A::CONST (NameError) 2011 7 19 24
  • 75. module_eval( ) module_eval module A module A CONST = "A's CONST" CONST = "A's CONST" def f def f class_eval <<-EOS class_eval { p CONST p CONST EOS } end end end end class K class K CONST = "K's CONST" CONST = "K's CONST" extend A extend A f f end end 2011 7 19 25
  • 76. module_eval( ) module_eval module A module A CONST = "A's CONST" CONST = "A's CONST" def f def f class_eval <<-EOS class_eval { p CONST p CONST EOS #=> "K's CONST" } end end end end class K class K CONST = "K's CONST" CONST = "K's CONST" extend A extend A f f end end 2011 7 19 25
  • 77. module_eval( ) module_eval module A module A CONST = "A's CONST" CONST = "A's CONST" def f def f class_eval <<-EOS class_eval { p CONST p CONST EOS #=> "K's CONST" } #=> "A's CONST" end end end end class K class K CONST = "K's CONST" CONST = "K's CONST" extend A extend A f f end end 2011 7 19 25
  • 78. module_eval( ) module_eval module A module A CONST = "A's CONST" CONST = "A's CONST" def f def f class_eval <<-EOS class_eval { p CONST p CONST EOS #=> "K's CONST" } #=> "A's CONST" end K A Object end end CONST end class K class K CONST = "K's CONST" CONST = "K's CONST" extend A extend A f f end end 2011 7 19 25
  • 79. module_eval( ) module_eval module A module A CONST = "A's CONST" CONST = "A's CONST" def f def f class_eval <<-EOS class_eval { p CONST p CONST EOS #=> "K's CONST" } #=> "A's CONST" end K A Object end A Object end CONST end CONST K class K class K CONST = "K's CONST" CONST = "K's CONST" extend A extend A f f end end 2011 7 19 25
  • 80. 2011 7 19 26
  • 81. module A B = 42 end A.class_eval do def self.f pB end end A.f 2011 7 19 26
  • 82. module A B = 42 Ruby 1.9 end 42 A.class_eval do def self.f pB end end A.f 2011 7 19 26
  • 83. module A B = 42 Ruby 1.9 end 42 A.class_eval do def self.f Ruby 1.8.7 -e:8:in `f': uninitialized constant B (NameError) pB end end A.f 2011 7 19 26
  • 84. module A B = 42 y Ruby 1.9 end b 42 def self.f pB R A.class_eval do c u Ruby 1.8.7 -e:8:in `f': uninitialized constant B (NameError) end end A.f 2011 7 19 26
  • 85. # abort when I pressed “About your application’s environment” in welcome page. ➡ Welcome aboard abort 2011 7 19 27
  • 86. # abort when I pressed “About your application’s environment” in welcome page. ➡ Welcome aboard abort 2011 7 19 27
  • 87. # abort when I pressed “About your application’s environment” in welcome page. ➡ Welcome aboard abort 2011 7 19 27
  • 88. # abort when I pressed “About your application’s environment” in welcome page. ➡ Welcome aboard abort 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 2011 7 19 27
  • 89. ... 2011 7 19 28
  • 90. ... MacRuby Rails ... 2011 7 19 28
  • 91. ... MacRuby Rails ... ➡ 2011 7 19 28
  • 92. ... MacRuby Rails ... ➡ ➡ @lrz Rails MacRuby 1.0 2011 7 19 28
  • 93. RubyConf ... To be continued... <morohoshi@netlab.jp> 2011 7 19 29