[MacRuby] #1277: singleton_methods/ancestors
#1277: singleton_methods/ancestors --------------------------------+------------------------------------------- Reporter: anoiaque@… | Owner: lsansonetti@… Type: enhancement | Status: new Priority: major | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: singleton --------------------------------+------------------------------------------- Suppose: class User; def self.all;end end '''With Ruby 1.8, and 1.9.2 interpreters : ''' User.singleton_methods #=> [:all] User.ancestors #=> [Class, Module, Object, Kernel, BasicObject] '''With Macruby :''' User.singleton_methods #=> [] User.ancestors '''0.8''' #=> [Class, Class, Class, Module, Kernel, Class, Kernel, NSObject, Kernel] Strange! '''0.10''' #=> [User, NSObject, Kernel] User is an ancestor of User (?) [More generally : can we expect, finally, that macruby interpreter is strictly compatible with 1.9.2, ie we can interpret 1.9.2 code with macruby interpreter and expect the same result ?] -- Ticket URL: <http://www.macruby.org/trac/ticket/1277> MacRuby <http://macruby.org/>
#1277: singleton_methods/ancestors --------------------------------+------------------------------------------- Reporter: anoiaque@… | Owner: lsansonetti@… Type: enhancement | Status: new Priority: major | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: singleton --------------------------------+------------------------------------------- Comment(by lsansonetti@…): Yes, you should expect MacRuby to behave as CRuby 1.9.2. In this case, clearly #singleton_methods isn't working. Otherwise, #ancestors behaves as expected, because Object is a shortcut to NSObject and BasicObject is not the root class of all objects. {{{ $ ./miniruby -e "class User; def self.all; end; end; p User.singleton_methods; p User.ancestors" [] [User, NSObject, Kernel] $ ruby1.9 -e "class User; def self.all; end; end; p User.singleton_methods; p User.ancestors" [:all] [User, Object, Kernel, BasicObject] }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1277#comment:1> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby