David A. Black wrote:
>
>    class C
>      def x
>        puts "I'm the #x from C"
>      end
>
>      def y
>        x    # call the most recently defined #x at the time of the
call
>      end
>
>      def z
>        C#x  # call the x defined in C, no matter what
>      end
>    end
>
>    class CC < C
>      def x
>        puts "I'm the #x from CC"
>      end
>    end
>
>    CC.new.y    # I'm the #x from CC
>    CC.new.z    # I'm the #x from C
>

If you don't mind David, I think this is good example to show what I
mean by a local namespace too. The local namespace idea is sort like
the original idea (differentiating on using self or not) but remains
backward compatible.

  class C
    def x
      puts "I'm the #x from C"
    end
    local :x   # localize x to C

    def y
      self.x   # call the most recently defined #x
               # in this case using self forces a non-local call
    end

    def z
      x        # call the x defined in C, b/c x is local
    end
  end

  class CC < C
    def x
      puts "I'm the #x from CC"
    end
  end

  CC.new.y    # I'm the #x from CC
  CC.new.z    # I'm the #x from C

Hope that makes my idea a bit clearer. This approach has an advantage
over notations like C#x also, in that modules can then be included into
a class' local space.

  module CM
    def x
      puts "I'm the #x from CM"
    end
  end

  class C
    include_local CM
    def x
      puts "I'm the #x from C"
    end
    def z
      x
    end
  end

  CC.new.x    # I'm the #x from C
  CC.new.z    # I'm the #x from CM

Note there isn't any name clash between the local and non-local x
methods (in fact that's the whole point) local methods are referenced
in there own namespace.

T.