[MacRuby] #1257: Calling super doesn't pass along the block
#1257: Calling super doesn't pass along the block ------------------------------------+--------------------------------------- Reporter: james@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: super blocks mechanize ------------------------------------+--------------------------------------- When you call super in macruby, it doesn't pass any blocks along; which is counter to the behavior in other rubys and causes gems that use this functionality, such as Mechanize (see #1218, #1182) to fail. See the following code: {{{ class Foo attr_accessor :a, :b def initialize(a) @a = a yield self if block_given? end end class Bar < Foo attr_accessor :c def initialize(a, c) @c = c super(c) end end # MacRuby 0.10 Bar.new(1, 3) {|foo| foo.b = 2} #=> <Bar:0x2003e80a0 @c=3 @a=3> # Ruby 1.9.2 Bar.new(1, 3) {|foo| foo.b = 2} #=> <Bar:0x000001009b85b0 @c=3, @a=3, @b=2> }}} For those interested, I made a patch to Mechanize 2.0.pre.2 https://github.com/jamesdaniels/mechanize -- Ticket URL: <http://www.macruby.org/trac/ticket/1257> MacRuby <http://macruby.org/>
#1257: Calling super doesn't pass along the block ------------------------------------+--------------------------------------- Reporter: james@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: fixed Keywords: super blocks mechanize | ------------------------------------+--------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.11 Comment: Thanks for reducing the problem, it should be fixed in https://github.com/MacRuby/MacRuby/commit/d54db7edd09046a6e74364eb49b35d48b7.... -- Ticket URL: <http://www.macruby.org/trac/ticket/1257#comment:2> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby