Evan Phoenix wrote:
> 
> On Jan 25, 2007, at 7:02 AM, Yukihiro Matsumoto wrote:
> 
>> Hi,
>>
>> In message "Re: new method dispatch rule (matz' proposal)"
>>     on Thu, 25 Jan 2007 13:58:25 +0900, Evan Phoenix 
>> <evan / fallingsnow.net> writes:
>>
>> |The more this discussion goes on, the more I worry that Joe Q Public
>> |programmer isn't going to be able to properly grasp these new rules.
>> |
>> |Everyone here is pretty much the creme de la creme of ruby core
>> |developers and we're all still having troubles get our minds around
>> |it (or at least I am).
>> |
>> |Let me propose a change to the rules that might help clean them up.
>> |Change rules 3 and 4 to be one rule that reads:
>> |
>> |"If functional style calling is used, say foo(1), foo is looked up
>> |first in the method table of the defining class as a private method.
>> |If it is not found, normal dispatch occurs."
>>
>> I think we need to summarize the current proposed schemes:
>>
>> (a) my original proposal
>>
>>   - functional style call will look for
>>
>>     (1) private methods up from defining class to Kernel
>>     (2) public methods up from the receiver's class to Kernel if not
>>         found in step 1.
>>
>>   - ordinary style call will look for
>>
>>     (3) public methods up from the receiver's class to Kernel.  private
>>         methods will be skipped.
>>
>> (b) Charles Nutter's proposal
>>
>>   - functional style call will look for
>>
>>     (1) any methods up from defining class to Kernel
>>
>>   - ordinary style call will look for
>>
>>     (2) he didn't say anything about this, either skipping private
>>         methods or raise error as we have today.
>>
>> (c) Evan Phoenix's proposal
>>
>>   - functional style call will look for
>>
>>     (1) private methods in the defining class/module.
>>     (2) any methods up from the receiver's class to Kernel if not
>>         found.
>>
>>   - ordinary style call will look for
>>
>>     (3) he didn't say anything about this, either skipping private
>>         methods or raise error as we have today.
>>
> 
> (3) Ordinary style calls will skip any private methods.
> 
> Looks good.

I think Evan and I actually have proposed the same thing in roundabout 
ways. I'm coming at it from a Java perspective, and I think we 
reasonably mimic Java's private behavior with these altered rules.

In truth, though, I am still interested in the reason why the original 
Rule 3 is useful in the presence of the other rules. If there is a 
reason I would very much like to know.

- Charlie