From: dblack@... Date: 2007-01-22T02:03:35+09:00 Subject: Re: Minor Change Proposal for Classes 'Object' and 'Method' ---2049402039-198629628-1169399012=:4065 Content-Type: MULTIPART/MIXED; BOUNDARY="-2049402039-198629628-1169399012=:4065" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---2049402039-198629628-1169399012=:4065 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Mon, 22 Jan 2007, Wolfgang N=E1dasi-Donner wrote: > dblack@wobblini.net schrieb: >> In any case, >> I included it because it demonstrates that there's a "meta" or >> two-step way of getting a message to an object, but that a.method(:x) >> isn't such a technique. > > "mo =3D a.method(:x)" creates a new object "mo" of class "Method", which= =20 > contains the object "a" and a reference (or however to name this) to a=20 > method. To find the method, ":x" will be interpreted as a message "x" to= =20 > object "a", but the corresponding method will not be executed, but refere= nced=20 > in the new Method object. I think we're talking past each other. > When writing "mo.call" the object "a" will be enforced to use the method= =20 > referenced by "mo" without any method lookup. This means, that the actual= =20 > state of object "a" will be used to call a method, which may be overwritt= en=20 > in the meantime. > > The name "receiver" for a method of class "Method", which returns the obj= ect=20 > for which "method" was called makes some sense, because in the moment=20 > "method" was called, the referenced method inside the "Method" object wou= ld=20 > be executed by the object when receiving the message named by the paramet= er=20 > for the "method" method. That's all correct, but the word "receiver" doesn't communicate it to me. Given this: m =3D a.method(:x) I do not consider it optimal to describe a as m's "receiver". It's a re-definition of the term, and I think it would lead to confusion. That doesn't mean that there's no relationship between m and a. It just means that the word "receiver" isn't the right word to describe that relationship. I'd rather see: m.target m.bound_object etc. -- something other than m.receiver. David --=20 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) ---2049402039-198629628-1169399012=:4065-- ---2049402039-198629628-1169399012=:4065--