From: Tomasz Wegrzanowski Date: 2001-12-28T09:22:17+09:00 Subject: [ruby-talk:29494] C extensions to Ruby: classes vs. types I have problems with Ruby classes in C "Programming Ruby: The Pragmatic Programmer's Guide" says: You can check to see what type of structure is used for a particular VALUE in a number of ways. The macro TYPE(obj) will return a constant representing the C type of the given object: T_OBJECT, T_STRING, and so on. Constants for the built-in classes are defined in ``ruby.h''. Note that the type we are referring to here is an implementation detail--- it is not the same as the class of an object. And I'm confused. Is there any document where type vs. class is explained in details ? I want to do something like that: static VALUE myclass_mymethod(VALUE self, VALUE arg) { VALUE ac = arg->class; VALUE result; if (ac.instanceof?(CLASS1) { result action1; } else if (ac.kindof?(CLASS2)) { result = action2; } else { throw exception } return result; }