Evaluation of references

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.
  1. Container is created within a Context where old reference is not mirrored
    1. mirror[ old => newer ] is set
    2. 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
    3. once fixed, the mirror becomes active. Old reference evaluates to new within that container.

  2. 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:
    1. 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
    2. reference field is set to newer, with Shadows history of being old outside current Context
These two situations are are illustrated by following figures.

Evaluation of references:

Mr_Jack.print( Ms_Jane ) ==> "sweet Jane"
  1. Mr_Jack receives Ms_Jane as parameter
  2. Ms_Jane is mirrored to sweet_Jane
  3. attributes of sweet_Jane are printed
Mr_Jack.receiveAndReturn( sweet_Jane ) ==> sweet_Jane
  • 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:
  1. Mr_Jack receives Ms_Jane as parameter
  2. Ms_Jane is mirrored to sweet_Jane in Context of Mr_Jack, with history of being Ms_Jane in caller's Context
  3. sweet_Jane is returned
  4. 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):

Context where references are evaluated:

SourceForge.net Logo Copyright (c) 2005, 2006, 2007 Peter Kehl