In the previous chapter I explained how a class can give children to other
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
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
Remember that the tick-notation (eg @'program ) goes up through the parents (and not the owners)
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)
&=top @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)
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.
Evaluation of @parent means going a dashed arrow backwards, and
evaluation of @owner means going a wavish arrow backwards
|number (1)||number (4)|
So, finally, when you evaluate the class, the compiler will print all children named
@number of @top, which are 1, 2 and 3: