Hi,

In message "Re: new method dispatch rule (matz' proposal)"
    on Wed, 24 Jan 2007 11:19:37 +0900, Daniel DeLorme <dan-ml / dan42.com> writes:

|So private and public methods *do* have different namespaces, in
|a certain way. While you can't have 2 methods with the same name
|in a given class, the private "chain" is pretty much independant
|from the public chain.

Yes.

|But the public chain is very much dependant
|on the private chain:
|
|  class A
|    private
|    def bar; "A"; end
|  end
|  class B < A
|    def bar; super+"B"; end
|  end
|  class C < B
|    def bar; super+"C"; end
|  end
|  C.new.bar #=> "AC"
|
|Am I correct in guessing that the super in C#bar would first look
|in the private method space and find A#bar, skipping B#bar? Or
|would 'super' have a different mechanism, bypassing private/public
|visibility?

When the method is public, super looks for its public super.  That is,
super in C#bar calls B#bar which is public, then super in B#bar tries
to find a public #bar in B's superclass.  But A#bar is private (and I
assume there's no public #bar defined in Object either), thus B#bar
raises NoMethodError.

|Sorry about all the questions. I'll admit that this mixing of
|private and public methods is unlikely to happen in the real world,
|but I'm trying to wrap my mind around all the implications of this
|dispatch model and it's not easy.

You don't have to be feel sorry.  It is a great chance to find a hole
(or holes) in my idea.

							matz.