From: James Byrne Date: 2006-02-25T06:35:29+09:00 Subject: Re: Private methods - only available to oneself? E. Saynatkari wrote: > 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). > Which is why I do not understand the purpose of the distinction between implicit and explict self. Both cases are simply references. Why does the interpreter not simply check the reciever object id for === self when accessing private methods? Where the context cannot determine intent with resict to assignment (ie foo = "value" is a variable reference but self.foo = "value" is a call to private method foo=) then self obviously must be provided, but why must it NOT be provided otherwise? This makes no sense to me unless it is due a parsing or other implementation limitation of the interpreter. If that is the case, well then so be it. What I am interested in discovering is whether or not their exists a lexical or grammerical reason for why self is not permitted as an explicit receiver for private methods except for cases of foo=, where it is then required. Regards, Jim -- Posted via http://www.ruby-forum.com/.