On Feb 16, 2008 12:30 PM, UpsNDowns <tnospamhomas / povtal.org> wrote: > Alas, my problem now is, that an assignment for my CS class requires me > to prove that the obj is an instance of the singleton. (And no, it's no > trick question, the teacher has even lectured about it and proposed a > solution at the labs--- which btw I don't buy). Has the instructor given a definition of what it means to say that an object is an instance of a class? Very frequently, in academic settings, a very precise definition of terms will be applied that may not exactly match any particular intuition, and there certainly are definitions where that might be true. Though, really, I'd argue that the singleton class of an object in Ruby is really effectively a more like a Class that inherits from the class of the object and is mixed in than it is like the class that the object is an instance of. (Though its not that, either, since regular classes can't be mixed in normally.) After all, if you have an Array foo, then in Ruby 1.9: c = class <<foo; self; end foo.instance_of? c # => false foo.kind_of? c # => true c.superclass # => Array foo.class # => Array c.superclass == foo.class # => true Note that this is different in Ruby 1.8.6: c = class <<foo; self; end foo.instance_of? c # => false foo.kind_of? c # => true c.superclass # => #<Class:Array> foo.class # => Array c.superclass == foo.class # => false