Hi --

More feedback, post-immersion :-)

On Fri, 22 Aug 2003, Dan Doel wrote:

> class Module

[skipping ahead a bit]

>     # More restrictive class instance variables

I'm not sure what you mean -- they're already pretty restrictive (see
below).

>     # These variables are shared by all instances of the class, but
                                          ^^^^^^^^^
(Do you mean subclasses?)

>     # subclasses cannot see or modify them through the accessors. The
>     # accessors will still exist, but they will deal with the subclass'
>     # own class instance variable, and not interfere with that of the
>     # superclass

I think what you're describing is what already happens with class
instance variables and accessors:

  irb(main):001:0> class A; class << self; attr_accessor :a; end; end
  => nil
  irb(main):002:0> A.a = 1
  => 1
  irb(main):003:0> class B < A; end
  => nil
  irb(main):004:0> B.a = 2
  => 2
  irb(main):005:0> A.a
  => 1

B inherits the methods a and a= from A, but those methods (which get
and set @a) operate in the context of B when called on B -- that is,
they get and set B's @a, not A's @a.  To get at A's @a you'd have to
ask A.


David

-- 
David Alan Black
home: dblack / superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav