next up previous contents
Next: Preferences Up: Metalevels Previous: Metalevel Methods

Default Metalevels


A default metalevel  is a special kind of metalevel that applies to all the features of a referent. The description of a metalevel is feature-wise: for each feature a method (as a value) or a metalevel method has to be specified. In a default metalevel we can specify a method (or a set of methods) for any feature (and all unspecified features) of a referent. A default metalevel has to be a refinement of the built-in default object. Essentially, a default metalevel is just a set (of methods) of which we specify a default metalevel relation with a referent R with the (default of R) idiom. The referent R can be a base-level object or a metalevel. Whenever a feature f of R is unspecified the method in the default metalevel is installed as method for feature f in R. More precisely, it is installed as the value of feature f of the metalevel of R. If the default specifies a set of methods, they are installed as the value of feature f of the metalevel of R. The default metalevel is used only when a feature is unspecified in any of the levels of the metalevel tower. However, only one default can be specified in such a towergif.

The following example specifies only one method for the default. The delegation method (already defined in Example 2.13) is used to delegate to the metalevel of homo-sapiens any feature not defined in person or the metalevel of person.


The consequence of this definition is that except for features defined the metalevel of person in Example 2.12 any other reference to a refinement of person will be delegated to the methods defined in the metalevel of homo-sapiens. Specifically, if a reference (>> species of person) is made, the feature species of the metalevel of person will be installed with a delegating method that will reference the feature species the metalevel of homo-sapiens--thus obtaining the method (or set of methods) for species.

The use of defaults is more similar to what is the current definition of inheritance in OOPL where inheritance is applied to any method and value. Noos offers by means of metalevels a more explicit, declarative, programmable and feature-oriented construct for metalevel inference about objects that other OOPL--including those supporting metaobject protocol. Default metalevels are constructs that support the more generic--and less controllable-- metalevel inference commonly found in OOPL--namely delegation an inheritance.

The example above shows the usage of a default metalevel to provide default methods--because is the default of a metalevel. The following example shows using a default for a base-level description.


If we ask (>> expensive? of my-artwork) the answer will be true. Notice that now the delegation method in the default is used as method for the expensive? task and delegates to artwork-prototype the same task, finally obtaining the value true. In this situation, the default installs the method at the base-level and the delegation is not of methods as before but of values.

next up previous contents
Next: Preferences Up: Metalevels Previous: Metalevel Methods

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