Yukihiro Matsumoto
1/22/2007 12:57:00 AM
Hi,
In message "Re: Minor Change Proposal for Classes 'Object' and 'Method'"
on Mon, 22 Jan 2007 09:27:28 +0900, dblack@wobblini.net writes:
|> "a.method(:x)" looks up a method corresponding message :x, so that we
|> can invoke the method later. It is more accurate to call it "target"
|> or "bound_method", as you pointed. But I feel like there's a
|> convention to call the target (or self) of a method as a "receiver" in
|> OOP context. Given that context, it's natural to call "a" receiver.
|
|I disagree; I don't think it's natural in context, because "receiver"
|is a dynamic role and the result of a.method(:x) is reflective.
I am not sure the difference between dynamic and reflective.
|method(:x) is more like a variation on respond_to?(:x). Neither of
|them actually puts the object in the receiver role; they just examine
|the current type of the object.
It is a receiver of message that retrieves a method corresponding a
certain message name. The object is a receiver when the method was
invoked by ordinary message sending.
|With Method#receiver, We'd end up saying things like, "obj is the
|receiver of this method", which sounds like a mistake ("method" for
|"message"), and also sounds like obj has actually played the receiver
|role.
Ah, I already say so often. The "receiver" is most quick term for me
to describe "self" in a method.
m = a.method(:x)
m.call(args)
represents
a.x(args)
given that we can invoke the particular method, message "x" passing is
done somewhere in above sequence, and "a" is a receiver of the passing.
matz.