On Jul 8, 2005, at 7:38 PM, Florian Growrote: > Daniel Sche wrote: > > >> irb(main):177:0* y=0 >> => 0 >> irb(main):178:0> def y; 1; end >> => nil >> irb(main):179:0> y >> => 0 >> irb(main):180:0> y() >> => 1 >> irb(main):181:0> y.class >> => Fixnum >> irb(main):182:0> >> how to get the class of the function y? >> or object_id for example? >> > > method(:y).class or method(:y).object_id > > > That's kind of a lie...(as I'm sure you know, and a relatively benign one) eg: logan:/Users/logan% irb irb(main):001:0> def y; 0; end => nil irb(main):002:0> a = method(:y) => #<Method: Object#y> irb(main):003:0> b = method(:y) => #<Method: Object#y> irb(main):004:0> a.object_id => 1118516 irb(main):005:0> b.object_id => 1113486 If method(:y) was really the wall to get y's object_id those numbers should be the same. In ruby methods aren't objects. you can use methods like method to get procs whose sole purpose is to call them, but y isn't really an object on its own. It might help to think of someObject.some_message as not calling a function or method name some- Message but trather that it is the syntax for sending a message named some_message to someObject. Indeed the dot notation one could pretend is syntatic sugar for someObject.send(:some_message). This also makes sense in the context of method_missing.