From: Rick DeNatale Date: 2007-10-24T06:45:13+09:00 Subject: Re: terminology: class methods versus kernel methods On 10/23/07, Thufir wrote: > "One secret about kernel methods like print: they are > actually class methods," according to why's poignant guide to ruby. > This is frustrating for me, because I first thought "oh, that's like a > static class method, a la Math.whatever()," and then accepted the > "kernel" terminology. > > Kernel means class methods? No, and I don't understand what why means. print is an instance method of the Kernel module. The Object class includes Kernel, so the instance methods of Kernel are effectively instance methods of every object, at least in Ruby 1.8. I think the only sense that print is a class method is that Module, and therefore Class inherits it from Object which gets it from including Kernel. In the same sense then ==, object_id, ... are class methods. In other words classes are objects. Ruby 1.9 introduces a BasicObject which doesn't include kernel and can be used for advanced use cases such as proxies which need to minimize the number of methods they implement. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/