On May 19, 2006, at 10:03 AM, Austin Ziegler wrote:
>
> No, there isn't. Why would you want that? I see no advantage to it,
> and it's odd. I prefer this, though:
>
>  class A
>    attr_accessor :a, :b, :c
>    private :b, :b=
>  end

Seems like a lot of redundancy there.  You are typing :b three times.
What if you had three public attributes and three private?

class A
   attr_accessor :a, :b, :c, :d, :e, :f
   private :d, :d=, :e, :e=, :f, :f=
end

vs.

class A
   attr_accessor :a, :b, :c
   private { attr_accessor :d, :e, :f }
end

The hidden state behavior of public, private, protected (changing the  
default visibility of method definitions) always seems a little  
awkward to me.
When they are used with arguments it doesn't seem as awkward.


Gary Wright