[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Minor Change Proposal for Classes 'Object' and 'Method'

Yukihiro Matsumoto

1/22/2007 3:27:00 AM

Hi,

In message "Re: Minor Change Proposal for Classes 'Object' and 'Method'"
on Mon, 22 Jan 2007 10:19:07 +0900, dblack@wobblini.net writes:

|> 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.
|
|But what does:
|
| m = a.method(:x)
|
|represent -- *without* making the call to the method? At that point,
|there has been no event (direct or indirect) where a has received "x".
|All we've done is create a Method object, based on a's interface. The
|only message-receiving is a receiving "method", but not "x".

Ordinary message passing

a.x

does the following steps

(1) retrieve a class of the object a.
(2) look-up method table in a class by name x
(3) if it doesn't exist, looks for super-class table
(4) invoke a method with self bound to the object a.

whereas

a.method(:x)

does steps 1 through 3, and creates a method object reserved for the
4th step. When we can call the object a in the former sequence a
receiver, what is wrong calling receiver too in the latter sequence,
even though target or bound_object is more accurate. Do you think
possible confusing critical?

matz.

1 Answer

dblack

1/22/2007 11:31:00 AM

0