[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

advice requested / attributes.rb

Ara.T.Howard

4/29/2005 10:27:00 PM

2 Answers

Dave Burt

4/30/2005 12:03:00 AM

0

"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


Ara.T.Howard

4/30/2005 12:38:00 AM

0