A few questions:
1) How is the search order for the parents of a particular class specified? In particular, is this determined at the Parrot level or at the language level? Can it change at runtime?
It's determined by the method invocation code.
2) Re. the classoffset op: how does this work when multiple parent classes specify the same attribute?
For instance, suppose 'foo' is the first attribute specified in classes 'Bar' and 'Baz', which are theselves unrelated (i.e. 'Bar' doesn't inherit from 'Baz', nor vice versa), but which are both parent classes of a third class 'Qux'. Now, if P0 holds an object of class 'Qux', does:
classoffset I0, P0, 'Bar'
return the same value as:
classoffset I0, P0, 'Baz'
or not?
Nope. When the Qux class is constructed the offsets for each of its parent classes (and their parent classes,a nd so on) are calculated, and are effectively custom on a per-class basis. So if we had the following classes with attributes:
Bar: a b c
Baz: x y z
and we had Qux and Xyzzy like so:
Qux: isa(Bar, Baz) Xyzzy: isa(Baz, Bar)
Then you had code that looked like:
new P0, .Qux new P1, .Xyzzy classoffset I0, P0, 'Bar' classoffset I1, P1, 'Bar' print I0 print "\n" print I1 print "\n"
you'd get:
2 5
(Because the first few attributes are reserved) *However*.... Attribute "b" is always at classoffset("Bar") + 1, regardless of where Bar is in the attribute list.
Basically any class code that directly accesses attributes should first query where that class's base offset is for the object in question and work from there.
I think I need to add in an example section.
3) If more than one parent class specifies a particular attribute, do all of these parents have to be removed before the attribute is removed?
Currently yes. That also means a class can have its attributes in the hierarchy only once, regardless of how many times it actually appears.
--
Dan
--------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk