For Element components of ElementContainer, it's just their
ElementShadowed parts which are saved. When ElementShadowed references
are retrieved from ElementContainer, they are associated with Context
current at that time.
Structure of ElementShadowed components stored in ElementContainer
depends on Context in which an original ElementContainer was
mutated. These components may have been mirrored in that
ElementContainer, or in any ElementContainer up the Context.
There are 2 possibilities for a mutation of ElementContainer to store
references which
are mirrored in that container. It can store either
original reference
and store a mirror entry
which translates it to another Element
that happens when original
Element was not yet mirrored in current Context (i.e. Context where
mutation is used)
or translated (i.e. target)
reference
with Shadows history of
being original reference wihin upper
Context
when the original
reference was already mirrored in earlier mutation level of the
container
according to way it was created. In both
situation the reference resolves same - the mirror applies within given
Context. When returning the reference up, outside container's Context,
the mirror is undone in both cases and reference is resolved back to
its original.
Container is created within
a Context where old
reference
is not mirrored
mirror[ old
=> newer
] is set
reference field is set to old;
the new mirror can't be
applied, because the mutation
is still in
progress, and the Container being mutated is not part of current Context
once fixed, the mirror
becomes active. Old
reference evaluates to new
within that container.
Container is mutated
within a Context which
already has old
mirrored to newer
container's original
may already have old
mirrored to newer,
but it doesn't store reference to either old
or newer
in the field which is going to be set
Then:
mirror[ old
=> newer
] is not set,
because
it is already in effect
in current Context
there is no access to old,
because that reference
gets already mirrored to newer
in given Context
reference field is set to newer,
with Shadows history
of being old
outside current Context
These two situations are are illustrated by following figures.
return what was received,
because sweet_Jane wasn't
mirrored within Context of Mr_Jack,
therefore it's not resolved
back when returning it up to caller's
Context
Mr_Jack.receiveAndReturn(
Ms_Jane
) ==> Ms_Jane:
Mr_Jack
receives Ms_Jane
as parameter
Ms_Jane
is mirrored to sweet_Jane
in Context
of Mr_Jack, with history of
being Ms_Jane
in caller's
Context
sweet_Jane
is returned
sweet_Jane
is converted to caller's
Context, and
because of Shadows history it is resolved back to Ms_Jane
Items View - how each object
sees other objects (after applying
mirrors to original references):