On 8/4/05, Stefan Achatz <erazor / mitochondrien.de> wrote:
> Ryan Leavengood wrote:
>> Stefan Achatz said:
> It's hard to understand, why i can't access the private singleton
> from Myclass anymore:
> class Myclass
>   def testing
>     self.bar
>   end
>   def self.bar
>   end
>   class << self
>     private :bar
>   end
> end

> I should say that i'm coming from c++ and it seems im lacking some
> understanding in the differences between static methods in c++ and
> singleton methods in ruby.

They're not at all related. They look like they might be, but
they're not.

By making Myclass.bar private, you are making it so that it can only
be called within its *self*, which is Myclass[1]. Therefore,
instances of Myclass cannot call Myclass.bar because their *self* is
not Myclass, but an instance of Myclass.

-austin
[1] Modulo, of course, #__send__.
-- 
Austin Ziegler * halostatue / gmail.com
               * Alternate: austin / halostatue.ca