7) all object opcodes should go through the vtable. From there the
implementation can either call into Parrot's default (src/objects.c) or
do whatever the class system needs.
8) attribute access
We currently have:
8.1) via classoffset and index
The index serves as a cache located in the bytecode. But there is no
means to invalidate that chache, if the class (or one of the base
classes) changed the layout. I don't know if a class can change under
the code, but given that we support highly dynamic languages it's not
unlikely that this can happen.
8.2) by fully qualified classname
The classoffset opcode needs the class name of the object, where the
attribute is located. The named access needs a fully qualified attribute
name with the class name inside.
That's probably ok for Perl6 as attributes are only visible in the class
defining them (IIRC) but it doesn't work for Python. This seems to cause
a problem for HLL interoperbility.
I think, we should do:
- toss the indexed attribute access
- allow unqualified attribute names:
attr = getattribute obj, "attr_name"
would (in the default implementation) return the first matching
attribute in the objects MRO. A full qualified name
"class_name\0attr_name" could still be used, if needed.
A class system can implement the (new) vtable:
which returns the offset of the attribute location relative to the
object. This offset can be cached in the PIC, which gives instant access
to the attribute from the opcode run loop.