[MacRuby] #297: ObjectSpace.each_object returns Class and Module objects when it shouldn't
#297: ObjectSpace.each_object returns Class and Module objects when it shouldn't --------------------------------+------------------------------------------- Reporter: ned@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: --------------------------------+------------------------------------------- each_object(someclass) returns objects that are not subclasses of the requested class. {{{ ObjectSpace.each_object(String).reject { |o| o.class.ancestors.include? String }.map { |o| o.class }.uniq => [Class, Module, NSString] }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/297> MacRuby <http://macruby.org/>
#297: ObjectSpace.each_object returns Class and Module objects when it shouldn't --------------------------------+------------------------------------------- Reporter: ned@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: --------------------------------+------------------------------------------- Comment(by lsansonetti@…): Can't reproduce this with experimental ToT {{{ $ ./miniruby -e "p ObjectSpace.each_object(String).reject{|o|o.class.ancestors.include?(String)}.map{|o|o.class}.uniq" [NSString] $ ./miniruby -e "p MACRUBY_REVISION" "svn revision 2032 from http://svn.macosforge.org/repository/ruby/MacRuby/branches/experimental" }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/297#comment:2> MacRuby <http://macruby.org/>
#297: ObjectSpace.each_object returns Class and Module objects when it shouldn't --------------------------------+------------------------------------------- Reporter: ned@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: --------------------------------+------------------------------------------- Comment(by ned@…): This was noticed with 0.4; will check out the experimental. -- Ticket URL: <http://www.macruby.org/trac/ticket/297#comment:3> MacRuby <http://macruby.org/>
#297: ObjectSpace.each_object returns Class and Module objects when it shouldn't --------------------------------+------------------------------------------- Reporter: ned@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: --------------------------------+------------------------------------------- Comment(by dev@…): in 0.5 this is still there, but with Module instances which are returned as Class instances {{{ $ macruby -e 'p ObjectSpace.each_object(Class).reject { |o| o.class.ancestors.include? Class }.map { |o| o.class }.uniq' [Module] }}} more general: {{{ $ macruby -e 'p( [Object,Module,Class,String,Array,Hash,Integer,Regexp,Range].map { |c| ObjectSpace.each_object(c).reject { |o| o.class.ancestors.include? c }.map { |o| o.class }.uniq.map { |o| {c => o} } }.select { |a| a.size > 0}.flatten)' [{Class=>Module}, {NSMutableString=>NSString}, {NSMutableArray=>NSArray}] }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/297#comment:4> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby