From: Christoph Date: 2003-12-01T02:00:53+09:00 Subject: Re: Class-level readers and writers David A. Black wrote: ... > What you're describing is a similarity, not a connection :-) I am not in the position to argue about fine point of the English language with you, but a similarity is a "kind_of" (in the OO sense) a connection in my orthographically challenged book:-) > What I mean is that there's no interdependency, conceptually > or in implementation, between class vars and class instance > vars. People look for connections in trying to understand > them, but they're actually best understood separately. Maybe you right about the latter point - I just don't know ... > > As for the new-style class variables compares with > traditional accessors defined on the Class object: the main > difference I see is that the accessors are presumably > callable by anyone, whereas the new class vars will be > class-local (including instance method definitions). It's You can can achieve the same effect by declaring the class accessor methods (the instance version) protected class A __var__ = nil protected define_method(:var) {|| __var__ } define_method(:var=) {|rhs| __var__= rhs } ... end Also I would not mind the introduction of ``class_protected'' visibility attribute for class methods. Of course, it is bit of a contradiction to champion an extra access modifier in order to simplify visibility rules:-) Example: Given declaration class A; end class B < A def self.meth puts "okay" end class_protected :meth end class B def m B.meth end End class A def foo B.meth end end B.new.foo # okay A.new.foo # NoMethodError - called class protected ... ... /Christoph