On May 19, 2006, at 6:31 AM, dblack / wobblini.net wrote:
> The behaviors provided by attr_* are implemented using instance
> variables, but that's not the whole instance variable story.  I'm not
> quite sure which constructs you're specifically thinking of, but if
> you want your attr_* methods private, just do:
>
>   class C
>     private
>     attr_accessor :x
>
>     # etc.
>   end

Is there any existing (or previously proposed) way of 'scoping' the  
behavior
of private?  I'm thinking something like:

class A
   attr_accessor :a
   private {
     attr_accessor :b
   }
end

I'm aware that you can 'toggle' visibility:

class A
   attr_accessor :a   # public
   private
   attr_accessor :b   # private
   public
   attr_accessor :c   # public
end

but it would seem some sort of block/scope notation would be cleaner.


Gary Wright