From: David MacMahon Date: 2013-10-30T22:01:09-07:00 Subject: [ruby-core:58095] Re: [ruby-trunk - Feature #9064] Add support for packages, like in Java On Oct 30, 2013, at 9:26 PM, Nobuyoshi Nakada wrote: > (13/10/31 5:15), David MacMahon wrote: >> It would be nice if the following were allowed: >> >> class Foo < Bar; end # class Foo extends Bar >> class Foo; end # class Foo still extends Bar > > This is allowed already. Wow! Neat! Thanks! I had completely missed that! I guess I should re-check my examples before complaining!!! :-) >> class Foo; end # class Foo has Object as a "stand-in" superclass >> class Foo < Bar; end # class Foo replaces Bar as its "official" superclass > > If it is allowed, > > class C; end > c = C.new > class C < String; end > c.size # will segfault > > with the current object system. Interesting. Why would it segfault instead of at least raising NoMethodError? It doesn't really matter now that I know the class can be reopened without specifying a superclass! Changing the class hierarchy does seem a little dubious, but then again having open classes at all is probably considered dubious by some... Thanks again, Dave