From: dblack@... Date: 2007-01-21T03:38:57+09:00 Subject: Re: Minor Change Proposal for Classes 'Object' and 'Method' Hi -- On Sun, 21 Jan 2007, Robert Klemme wrote: > On 20.01.2007 18:54, Phrogz wrote: >> Robert Klemme wrote: >>> I opt for "defining_class", because this precisely states what it >>> returns. Some might find it a bit much of typing but I think we have >>> much worse cases in Ruby (attr_accessor for example, which is much more >>> often used). If someone can come up with an equally clear name which is >>> shorter, that's fine with me. >> >> I have two objections to this: >> 1) The fact that there are some methods which are a pain to type does >> not mean that we should feel OK about making all methods a pain to >> type. Certainly, verbose naming matters less of the method would be >> infrequently used (as this one would). But we should continually strive >> for a balance between clarity and terseness (and I see that you >> implicitly agree with that, given your last sentence). > > Exactly. > >> 2) If a method is rebound to a new object, what is desired (I think) is >> the current 'parent' class of the method, not the one where it was >> defined. If derivatives of the word 'defined' are in the method name, >> this (edge) case will be confusing. > > I am not sure I understand what you mean by "parent class". If you refer to > the class of the instance the method is bound to then that would be available > via meth.receiver.class. When rebinding a method to another receiver then > the defining class does not change, does it? Did I miss something? I think you're right, because objects don't have methods, only classes and modules do. I'm not quite understanding the idea of meth.receiver, though. How does that fit in with the idea of the receiver being whatever object a given message is sent to (which could, in most cases, be any of many objects)? David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)