James Byrne wrote: > Hal Fulton wrote: >> Minkoo Seo wrote: >>> Thanks, Erik. I'm afraid that I'm not a native English spearker, so >>> sometimes it's not easy to express my own idea in exact English >>> expression. >>> >>> Of course, I did look up the reference and found what instance_eval >>> does when being called. What I tried to ask was, as you stated, >>> "If we can do this, what's the purpose of 'protected' or 'private'?" >> >> 'private' is not like a locked door. It is like a sign saying "Do Not >> Enter.' >> >> Or look at it this way: It makes it "more difficult" to access private >> vars (so that you will know you shouldn't), but doesn't make it >> impossible (in case you really, really need to). >> >> >> Hal > > I do not understand why within the class definiton the Ruby interpreter > distinguishes between implicit and explict calls to self. Think of the self.foo call just accessing an object called 'self'--sure, it is actually the same object, but you could just as well replace 'self' with the external variable name. You are still sending a message to an explicit receiver, which is not possible in Ruby for any private methods (except for the self.foo = 5, where it is required). > <snip, rforum /> E -- Posted via http://www.ruby-forum.com/.