[MacRuby] #1096: Operator redefinition fails (Fixnum)
#1096: Operator redefinition fails (Fixnum) --------------------------------------+------------------------------------- Reporter: Knut.Olaf.Lien@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.8 Component: MacRuby | Keywords: --------------------------------------+------------------------------------- This example is taken from ruby-lang.org page: {{{ Class Fixnum def +(other) self - other end end }}} Testing this does not yield correct result in MacRuby 0.8 (ruby 1.9.2) [universal-darwin10.0, x86_64] Tested correct in ruby 1.8.7 (2009-06-12 patchlevel 174) [universal- darwin10.0] and ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0] -- Ticket URL: <http://www.macruby.org/trac/ticket/1096> MacRuby <http://macruby.org/>
#1096: Operator redefinition fails (Fixnum) --------------------------------------+------------------------------------- Reporter: Knut.Olaf.Lien@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: worksforme Keywords: | --------------------------------------+------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => worksforme * milestone: MacRuby 0.8 => Comment: It works for me. {{{ $ ./miniruby -e "class Fixnum; def +(o); self-o; end; end; p 4+2" 2 }}} Please provide test input. -- Ticket URL: <http://www.macruby.org/trac/ticket/1096#comment:1> MacRuby <http://macruby.org/>
#1096: Operator redefinition fails (Fixnum) --------------------------------------+------------------------------------- Reporter: Knut.Olaf.Lien@… | Owner: lsansonetti@… Type: defect | Status: reopened Priority: blocker | Milestone: Component: MacRuby | Resolution: Keywords: | --------------------------------------+------------------------------------- Changes (by Knut.Olaf.Lien@…): * status: closed => reopened * resolution: worksforme => Comment: Does not work sing macirb though. Tried the same approach as you did and get the correct result. So this may be a bug in macirb? See transcript below. irb(main):001:0> class Fixnum irb(main):002:1> def +(o) irb(main):003:2> sel-o irb(main):004:1> end irb(main):005:0> end => nil irb(main):006:0> 4+2 => 6 irb(main):007:0> -- Ticket URL: <http://www.macruby.org/trac/ticket/1096#comment:2> MacRuby <http://macruby.org/>
#1096: Operator redefinition fails (Fixnum) --------------------------------------+------------------------------------- Reporter: Knut.Olaf.Lien@… | Owner: lsansonetti@… Type: defect | Status: reopened Priority: blocker | Milestone: Component: MacRuby | Resolution: Keywords: | --------------------------------------+------------------------------------- Comment(by Knut.Olaf.Lien@…): See proper formatted transcript below:: {{{ EPC-knut:~ knut.olaf$ macirb irb(main):001:0> class Fixnum irb(main):002:1> def +(o) irb(main):003:2> self-o irb(main):004:1> end irb(main):005:0> end => nil irb(main):006:0> 6+4 => 10 }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1096#comment:3> MacRuby <http://macruby.org/>
#1096: Operator redefinition fails (Fixnum) --------------------------------------+------------------------------------- Reporter: Knut.Olaf.Lien@… | Owner: lsansonetti@… Type: defect | Status: reopened Priority: blocker | Milestone: Component: MacRuby | Resolution: Keywords: | --------------------------------------+------------------------------------- Comment(by watson1978@…): {{{ $ cat test.rb class Fixnum def +(o) self-o end end p 4+2 $ macruby test.rb 2 $ macirb irb(main):001:0> load "test.rb" 2 => true $ macirb irb(main):001:0> class Fixnum irb(main):002:1> def +(o) irb(main):003:2> self - o irb(main):004:1> end irb(main):005:0> end => nil irb(main):006:0> p 4 + 2 6 => 6 }}} I wrote your code within macirb, I reproduced. [[BR]] but, used only MacRuby and loaded test core within macirb, I did not. Probably it will be a problem of macirb. -- Ticket URL: <http://www.macruby.org/trac/ticket/1096#comment:4> MacRuby <http://macruby.org/>
#1096: Operator redefinition fails (Fixnum) --------------------------------------+------------------------------------- Reporter: Knut.Olaf.Lien@… | Owner: lsansonetti@… Type: defect | Status: reopened Priority: blocker | Milestone: Component: MacRuby | Resolution: Keywords: | --------------------------------------+------------------------------------- Comment(by watson1978@…): sorry, type miss X( s/test core/test code/ -- Ticket URL: <http://www.macruby.org/trac/ticket/1096#comment:5> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby