[MacRuby] #250: subclassing Array
#250: subclassing Array -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: subclassing, Array -------------------------------------+-------------------------------------- {{{ class Board < Array def initialize(*args) super 0.upto(7) do self << (0..7).map{[]} end end end b = Board.new }}} {{{ ./miniruby -I./lib -e "class Board < Array; def initialize(*args); super; 0.upto(7) do; self << (0..7).map{[]}; end; end; end; p Board.new" # => [] }}} {{{ macruby -e "class Board < Array; def initialize(*args); super; 0.upto(7) do; self << (0..7).map{[]}; end; end; end; p Board.new" # => [] }}} {{{ ruby19 -e "class Board < Array; def initialize(*args); super; 0.upto(7) do; self << (0..7).map{[]}; end; end; end; p Board.new" # => [[[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []]] }}} {{{ ruby -e "class Board < Array; def initialize(*args); super; 0.upto(7) do; self << (0..7).map{[]}; end; end; end; p Board.new" # => [[[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], []]] }}} I think the problem is pretty obvious, let me know if you need more explanations. -- Ticket URL: <http://www.macruby.org/trac/ticket/250> MacRuby <http://macruby.org/>
#250: subclassing Array -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.6 Component: MacRuby | Resolution: fixed Keywords: subclassing, Array | -------------------------------------+-------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.6 Comment: This problem seems to be fixed as of r3489. Closing. -- Ticket URL: <http://www.macruby.org/trac/ticket/250#comment:1> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby