From: Alexandru Popescu Date: 2006-06-02T00:58:39+09:00 Subject: Re: OO / Private verse Protected Thanks Joel and Jim. I was aware that there are differences between Ruby private/protected and Java private/protected, that's the reason why I have said it load: "at least in Java these modifiers....". I know how these are working for Java and I was commenting about their usability. Indeed, considering that I am on the Ruby ML, I should have probably prefix my messages with a little offtopic, so I apologize for this. BR, ./alex -- .w( the_mindstorm )p. On 6/1/06, Jim Weirich wrote: > Alexandru Popescu wrote: > > At least in Java these modifiers are quite usefull: a protected method > > is one that offers extensibility/polymorphic behavior for hierarchies, > > without exposing it as public API. So the behavior may vary according > > to the implementation, and the exposed API/public methods are a > > completely different thing. > > Keep in mind that Ruby protected and private have slightly different > meanings than in Java. Private protection in Ruby is instance based. > That means that private methods are callable only within the object > instance, but (unlike Java) that instance need not be a direct instance > of the class. > > Ruby protected seems to be pretty close to the Java concept of > protected, AFAICT (minus the package exposure in Java). However, I > almost never use Ruby protected so I am probably missing some > subtleties. > > -- Jim Weirich > > -- > Posted via http://www.ruby-forum.com/. > >