( ) Refering owner class ( )

In the previous chapter I explained how a class can give children to other classes.
Often, you will need the definition of these children to depend on the class that defined them.


In the same way as @parent allows to access the parent class, @owner allows to access the class that defined the child, or more precisely the class that propagated it. If for instance a class @bottom is a subclass of a class @top which defines something, then @bottom is the owner of the inherited classes

@owner vs. @parent

Don't mistake these two symbols: the parent class is the one of which the current class is a child, and the propagating class is the one that created the child
Remember that the tick-notation (eg @'program ) goes up through the parents (and not the owners)

more about propagation

As these concepts are a bit difficult to grasp, I'll make a little example here.

The sequence @forAll( @number &, , &, @number &) is an internal class; it will output all values of the symbol @number separated by commas (internal classes and call with arguments are explained in the next chapters)

  @forAll( @number &, , &, @number &)
  &+number 1
    &+parent.number 2
      &+parent.number 3
        &+number 4

You should really never write cryptic code like that, but it's here just an example to show how it works!

This graph shows the defining relationships between the classes, i.e. before propagation (a wavish arrows means "owns", and evaluating @owner on a class means follow such an arrow backwards)


number (1)

number (2)

number (3)

number (4)

This is how the same graph looks like, after propagation:

The compiler followed the defining relationships (wavish arrows) to decide where the next one should be attached

For instance, for attaching @number (2), declared with &+parent.number, the compiler went up the dashed arrow to reach the parent (@top), and then added the definition there.

top number (3)

Evaluation of @parent means going a dashed arrow backwards, and evaluation of @owner means going a wavish arrow backwards
For instance, the owner of @number 3 is 2, and the parent of @number 3 is @top.

number (1)  number (4)
number (2)

So, finally, when you evaluate the class, the compiler will print all children named @number of @top, which are 1, 2 and 3:

Maxime Gamboni <> Last compiled : Wed Apr 23 21:53:41 CEST 2003