On 1/9/06, dblack / wobblini.net <dblack / wobblini.net> wrote: > > Aren't all ruby objects under the hood of type VALUE? > > But Ruby != Ruby-under-the-hood :-) True. :) > > sandal@karookachoo:~$ irb > > irb(main):001:0> 3.type > > (irb):1: warning: Object#type is deprecated; use Object#class > > => Fixnum > > > > So... aren't we supposed to ignore type now? ;) > > The reason #type is deprecated is not that there's no such thing as > type, but that having a #type method that returns the object's class > leads people to think that type and class are the same. In fact, my > understanding is that the only reason Matz resorted to a #type method > was that there were problems getting the parser to treat "class" as a > method name, even with an explicit receiver. interesting > > Please elaborate on what you meant by this, because I am interested. > > ( My conception of ruby's type system might have been wrong) > > The type of a Ruby object, as I understand it, is basically its > capabilities, at a given point during runtime. So objects have types > -- but the types themselves are anonymous and, in a sense, circular. > (The type of x is "the type that objects that do what x does have".) Hence duck-typing, no? ;)