[MacRuby-devel] Super not passing init: through to NSObject correctly?
Michael Shapiro
koudelka at ryoukai.org
Mon Oct 5 18:37:01 PDT 2009
Hi all,
I searched a few months of the list archives and trac, but wasn't able
to find reference to this.
Calling `super` inside of an overridden #init function where no ruby
ancestors define #init causes a segmentation fault. If I'm not
mistaken, shouldn't the init: message be passed to NSObject?
---------------------------------------------------------
class HasInit
def init
super
p 'HasInit'
self
end
end
class A < HasInit; end
class B < A; end
A.new
p 'A'
B.new
p 'B'
class HasNoInit; end
class C < HasNoInit; end
class D < C
def init
super
self
end
end
C.new
p 'C'
D.new
p 'D'
---------------------------------------------------------
You should see the segfault happen when trying to init D, but HasInit
passes the message through to NSObject just fine, it seems.
Tested with the 2009-10-05-1158 nightly.
Thanks!
--Mike
More information about the MacRuby-devel
mailing list