Li Chen <chen_li3 / yahoo.com> wrote:

> Thank you so much. Here is my implement of an instance method. But I 
> cannot explain very clear why I  can #each directly without a receiver.

Method calls are sent to "self" if they are not sent explicitly to a
receiver. Since this is an instance method, "self" is a Hash instance.

You *can* say "self.each" in that case if you want to. Most people
don't; I usually do; it's a matter of style. However, in *some* cases
(e.g. the method is private) you *can't* say "self" (because "private"
means that an explicit receiver is not allowed). For example, that is
why you can say

print "hello"

but you can't say 

self.print "hello"

It's because "print" is an instance method of the instance you are in,
but it's private.

m.

-- 
matt neuburg, phd = matt / tidbits.com, http://www.tidbits.com/matt/
Leopard - http://www.takecontrolbooks.com/leopard-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com