From: Jim Weirich Date: 2006-02-25T06:58:41+09:00 Subject: Re: Private methods - only available to oneself? James Byrne wrote: > I do not understand why within the class definiton the Ruby interpreter > distinguishes between implicit and explict calls to self. Possibly because it allows you[1] to examine the code and statically determine if a private method is allowed. If the implicit receiver rule were not used, then is the following a valid use of a private method? def f(other) other.private_method end Well, maybe or maybe not. It depends how it is called. f(self) # private method inside of f is ok f(you) # private method inside of f is probably not ok, # (but it really depends on the value of you, doesn't it) By using the implicit receiver rule, we know for sure that calling "private_method" in f is not ok. Less ambiguity. BTW, the Eiffel language also uses instance based protection (like Ruby) and also uses the implicit receiver rule as well. So there is precedent. -- -- Jim Weirich -- Posted via http://www.ruby-forum.com/.