Inheritance in DLP

\dlpindex{inheritance} In section \ref{des/ext/obj:states} we have introduced the notation object a:b { ... } for indicating that object a inherits both the non-logical variables and the clauses of object b. Inheritance is static, in that the non-logical variables and the clauses of the inherited objects are just added to those of the inheriting object.

Multiple inheritance

\dlpindex{multiple inheritance} is allowed. We may put object a:(b,c) { ... } to effect that object a inherits both b and c. Moreover inheritance is recursively applied, in that also objects inherited by inherited objects are inherited. \dlpindex{inheritance graph} \dlpindex{cycles} Cycles in the inheritance graph may occur. Nevertheless, each object is inherited only once, since it is checked whether it has already been inherited. We say that an object occurs earlier than another object in the inheritance list, if in applying inheritance recursively (depth first, in left to right order) it is dealt with before the other object. For dealing with cycles and possible clashes it is convenient to assume that the inheriting object itself occurs as the first object in the inheritance list. As an example, the declaration
  object a:(b,c) { ... }
  object b:(d,a)  { ... }
  object d:e  { ... }
  
results in the list a \. b \. d \. e \. c as the inheritance list for a, the list b \. d \. e \. a for b and d \. e for d.

Clashes

\dlpindex{clashes} may occur, when using such a copying method for inheritance, between non-logical variables with the same name, and between clauses defining a similar predicate. Clashing non-logical variables are treated in a very simple-minded way. When encountering multiple non-logical variables with the same name, and possibly different initializations, the one belonging to the object occurring first in the inheritance list is chosen. \nop{ Problems with respect to the inheritance of attribute values, such as represented by the famous Nixon-diamond (cf.  [To84]) do not occur, simply because only non-logical variables and not their values are assumed to be inherited. } Since the inheriting object is considered to occur as the first object in the inheritance list the initializing expressions for variables defined for the object itself take precedence over other initializations.

Overriding versus backtracking

\dlpindex{overriding} \dlpindex{backtracking} For clauses that define a similar predicate, occurring in different objects, there is the choice between inheriting them in an over\-riding fashion (by overwriting them) or to allow backtracking over all clauses occurring in objects in the inheritance list. Overwriting clauses implies that whenever a clause from the inheriting object succeeds, no clause of the inherited objects is tried for solving the (sub)goal. Since DLP is intended for knowledge based applications the clauses of the inherited objects are added to the clauses defined for the object itself, in the order in which the inherited objects occur in the inheritance list (see also section \ref{DLP:extensions}).