Eric Jacoboni <jacoboni / univ-tlse2.fr> writes:

> So my use of 'private', above, don't have the semantic i used to
> consider, as anyone is able to call a private method simply by creating
> a subclass.

It's a philosophical thing. 'private' is an indication that you're not
supposed to be using this method outside. However, you can always get
around this in Ruby:

  class Fred
    def meth
      puts "private"
    end
    private :meth
  end

  Fred.new.meth   #=> error

  class Fred
    public :meth
  end

  Fred.new.meth   #=> "private"


In a language where the source code is always available at runtime,
this seems reasonable. If someone wants to ignore a big hint saying
"don't do this", then they'll always be able to., and they'll reap
whatever trouble they deserve :)



Dave