Dave Burt
4/30/2005 12:03:00 AM
"Ara.T.Howard" <Ara.T.Howard@noaa.gov> asked:
>
> class A
> class_attributes %w( x y z )
> x 4
> y 1
> z 1
> end
>
> class B < A
> y 2
> end
> <snip>
> so, as you can see these class attributes are 'inherited' instance values.
> this is done using class instance vars and a search up the ancestors list
> if an
> attribute has not been set (defined?) in a class.
>
> questions :
>
> - does this sit o.k. with people : does it violate pols? i think it's
> quite
> natural but that's me ;-)
POLS belongs to Matz, doesn't it? :)
> - what do i call it? for now i'm calling it an class 'inherited'
> variable
> since it's not really a class instance (@) var nor a hierarchy (@@)
> var.
I don't see that it's clear that these are not @@ variables - wouldn't that
be the obvious implementation for that behaviour, and for something called
"class attributes"?
Cheers,
Dave