In article <VAE48.64857$h31.3384441 / e420r-atl1.usenetserver.com>,
Phil Tomson <ptkwt / shell1.aracnet.com> wrote:
>
>>I don't think I can cleanly do exactly what I want in 
>>Ruby. Maybe I just need to get comfortable with leaving 
>>doPrivateThing public, as much as it pains me. BUT, I
>>suspect that someone out there (who is less tainted by 
>>C++) has a Ruby-friendly way of accomplishing the same 
>>thing. Hope they speak up.
>
>Maybe it's possible that one could define a C++-like friend  mechanism in 
>class Class?  you could add a class variable array called @@friends and 
>you could add classes which are 'friend's of the current class to this 
>array - then somehow (and this is what I'm not sure of) calls to a class's 
>private or protected methods could be checked against the @@friends list 
>to determine if it's OK to proceed.... but I'm just thinking out loud 
>here, I don't have any idea how to do this (or even if it's possible)  
>maybe someone else can build on this idea. 
>

Actually, in thinking about it a bit more that proposal to  Class 
probably wouldn't work... How does 'protected' implement it's magic?  
Probably each time a class is subclassed the subclasses get added to a 
list of classes that can call the superclass's protected methods.  If one  
could figure out how to add other class names to that list (as friends)?

Just a thought... It might allow 'friend classes' to access protected 
methods on an object perhaps.  

Phil