next up previous contents
Next: Reference Up: Descriptions Previous: Concept descriptions



Inheritance--as usually understood in OOPL--involve two different aspects that are distinguished in Noos: subtyping and code reuse. Subtyping is modeled in Noos by subsumption and explained in Chapter 3. Code reuse is achieved by refinement.

tex2html_wrap_inline1865 A new description can be constructed reusing another description (or part of another description). The description that is ``reused'' is called the constituent of the description newly created. The refined description can have an identifier (named description) or not (anonymous description). Only named descriptions can be used as constituents and can be refined. The syntax for refinement (if D is the identifier of a description) is the following:

anonymous description
(define (D) NewBody)

named description
(define (D newD) NewBody)

The intuition behind refinement is that the new description newD will have the slots defined in NewBody plus a ``copy'' of all the slots in the Body of the constituent D except those redefined in NewBody--we say the new slot definition overrides the constituent's slot definition. However, this ``copy'' is performed again on demand: only those slots that are needed will be ``copied'' from the constituent (or the constituent's constituent).

Anonymous descriptions have the advantage that we can define local descriptions, that is refinements of descriptions that exist only as feature values. This local descriptions are also ``copied'' to refined descriptions. In the Example 2.2 person, man and women are defined. The father and mother of a person are defined by local descriptions of man and woman. When we introduce how to define methods in slots (cf. § 2.3) well see methods are also ``copied'' and why we insist in double-quoting this word. Descriptions that do not refine any prior existing is considered as if they were refinements of any , the most general description. That is to say, expression (define thing (solid true)) is syntactic sugar for (define (any thing) (solid true)).


Lazy (on demand) evaluation means that no expression is evaluated unless it is needed for some computation. A description can thus refer to the name of another description even if it is defined later--on the listener or on the file being loaded or on another file. However, refinement appearing on the root of a description do require the constituent to be already defined. The reason is that the outmost define in a description (the root) is evaluated when loading a file or typing on the listener. Anonymous descriptions appearing inside a description are not evaluated until needed. For this reason local descriptions (also called subdescriptions) can refine a description that is defined later--or the same description being defined. A correct and an incorrect order of refinement are shown on Examples 2.2 and 2.3.

concept descriptions can describe abstract concepts or concrete concepts, although until this moment the examples have been rather concrete. In order to proceed with abstract (or generic) concepts we turn next to reference--or in other words, variables and their binding.

next up previous contents
Next: Reference Up: Descriptions Previous: Concept descriptions

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