Hi,

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

|Do I understand correctly that:
|  class A
|    def foo; "priv"; end
|    private :foo
|    def foo; "pub"; end
|    def bar; foo+self.foo; end
|  end
|  A.new.bar #=> "privpub"
|
|I'm not sure what is the use case for this (apart from "let's break backwards
|compatibility since we are allowed to").

No.  Private methods do not have separate namespace, so the second foo
overwrites the first.  The intention is to prevent private functions
to affect external (public) namespace.  When I want to refactor out
some methods as private methods, under current behavior we have to
worry about name conflict.  But by new method search scheme, methods
in the subclass do not affect the function style invocation.

|> (4) (unconfirmed) private method dispatch searches from caller method class.
|
|Do I understand correctly that:
|  class A
|    def foo; bar; end
|    private
|    def bar; "A"; end
|  end
|  class B < A
|    private
|    def bar; "B"; end
|  end
|  B.new.foo #=> "A"
|
|So the only way to do polymorphism would be through public methods?

Yes.

							matz.