next up previous contents
Next: Delegation and Inheritance as Up: Metalevel Descriptions Previous: The Reflection Engine

Reification of Path References

  

Reification is the process by which an expression is converted into an object (a value) of a particular language. Most of the capabilities of reification are explained in Chapter 4, and we will focus here on of the more frequently used: on reifying paths references.

tex2html_wrap_inline1865 In Noos, path references can be reified into the metalevel as methods.

Reification is obtained using the reify construct, and in the following example a path reference is reified into an access-method--the sort of methods that denote path references.

frag686

There is also a way using method descriptions to define references (qua methods). The following example shows three equivalent ways of defining an access method: the first expression reifies a reference, while the third expression is purely a method description. The second expression is a method description that still maintains a part of the reference. Note that the specifying domain feature of am1 method requires a single parenthesis for a reference (2nd expression) and a double parenthesis for a method description (3rd expression).

frag695

This construct is handy when we require to have multiple alternative references in a feature--in other words, a disjunction of constraints. In the following example a person has to be located by phone but there are several phone numbers where she could be found. An easy way to model this is to have a disjunctive set of path references to different phone numbers.

frag700

As this example shows, phone-number feature has at the metalevel three reified path references. Intuitively, if each reference is a constraint, a metalevel feature that is a disjunctive set means that one of this constraints have to be satisfied by the phone number of a professional. Since they are also methods, we can also interpret them as three different ways to find out the number where a professional can be located.

A common idiom is that of converting a set of values or references into a disjunctive set in order to be able to choose among them. In the following example we have a Walter, person that has several sons (a set value on the sons feature. Then we have the information that he is residing in the home of one of its sons. How can we express this information in a home feature? We need a usage of reify such that reifies the result of an inference. The expression (reify of reference) first evaluates the reference and the result is then reified. Note that the of token marks the difference between this usage and the prior one where the path reference itself is reifiedgif.

frag717

The home feature has a reification of the result of reference (>> home sons) that is the set of homes Walter might reside in. Since they are to be the value of a metalevel feature they have to be reified and thus the reify of tokens. The reflection engine will reflect down one of the two reified values to the base-level home feature if the reference (>> home of walter) takes place. The process of reflecting down is the opposite of reifying (or lifting) a value so the two values are no longer reified on the base-level home feature.

If the values are lifted to the metalevel but not reified, as in the example below, the reference is setting the value of a metalevel feature to its expected values--namely methods. When reflecting down this values they will be applied yielding the error of applying a constant term.

frag731

In other terms, the reify constructs (lifts) path references into methods and constant terms into quoted terms (lifted constants). We can turn now to other usages of path references in metalevel features.


next up previous contents
Next: Delegation and Inheritance as Up: Metalevel Descriptions Previous: The Reflection Engine

Enric Plaza
Thu Jan 23 11:36:28 MET 1997