Projects
Home     Blog     Install     New Ticket     View Tickets     Browse Source

Ticket #13 (closed defect: fixed)

Opened 9 months ago

Last modified 4 months ago

dispatcher goes into infinite loop, crashes rather than throwing NoMethodError

Reported by: jean_pierre@… Owned by: lsansonetti@…
Priority: blocker Milestone: MacRuby 0.3
Component: MacRuby Keywords:
Cc:

Description

>> class Giant
>   def name
>     @name
>     end
>   def setName(name)
>     @name = name
>     end
>   end
# => nil

>> g = Giant.new
# => #<Giant:0x19fdd90>

>> g.name = 'Fasolt'
zsh: segmentation fault  /usr/local/bin/irb

seems like the dispatcher knows of the setName / name= bridging and is getting hung up somewhere.

Change History

Changed 9 months ago by lsansonetti@…

  • milestone set to MacRuby 1.0

Changed 4 months ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from MacRuby 1.0 to MacRuby 0.3

Fixed in trunk.

$ cat /tmp/t.rb 
class Giant
  def name
    @name
  end
  def setName(name)
    @name = name
  end
end

g = Giant.new
g.name = 'Fasolt'
$ macruby /tmp/t.rb 
/tmp/t.rb:11:in `<main>': undefined method `name=' for #<Giant:0x28a11f0> (NoMethodError)

The foo=: shortcut only works if setFoo: is a real Objective-C method. It does not work if setFoo: is implemented in Ruby to not cause confusion, if one defines both foo=: and setFoo:, as these are 2 different methods.

Note: See TracTickets for help on using tickets.