Jon Lang wrote:
Daniel Ruoso wrote:
TSa wrote:
May I pose three more questions?
1. I guess that even using $!A::bar in methods of B is an
access violation, right? I.e. A needs to trust B for that
to be allowed.
Yes
2. The object has to carry $!A::bar and $!B::bar separately, right?
Yes
3. How are attribute storage locations handled in multiple inheritance?
Are all base classes virtual and hence their slots appear only once
in the object's storage?
In SMOP, it is handled based on the package of the Class, the private
storage inside the object is something like
$obj.^!private_storage<A::><$!bar>
and
$ojb.^!private_storage<B::><$!bar>
Note that this ought only be true of class inheritance; with role
composition, there should only be one $!bar in the class, no matter
how many roles define it.
Yes, though note that they will only share a slot if they have the exact
same type. Otherwise it's a composition-time error.
Jonathan