At 6:53 PM +0100 4/8/04, Mark Sparshatt wrote:
I've got a couple of questions about Atrributes in Parrot.

PDD15 says that both classes and objects have a list of attributes and it is possible to add or remove attributes to a class but not an object.

Am I right in thinking that the attribute list for an object is just a copy of the attribute list for the class, which is used to store the objects values?

It seems that for Ruby instance variables can be modelled using attributes, but I couldn't see any way of handling class variables. So, what is the recommended way of handling them?

First, one takes the bat labeled "Metaclasses" and smacks the designer in the head with it. Then, once enlightenment has hit, we implement metaclasses and you add class variables as new attributes on a class' metaclass. I think.


Alternately you can stick 'em in as plain variables in the class namespace, which is probably the right answer for the moment, though not for the long run.
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to