DynBindModel: Difference between revisions
| Line 76: | Line 76: | ||
====Its construction==== | ====Its construction==== | ||
We introduce the shurtcut <math>S_m</math> to denote the system with classes <math>\left\{ C_1 \ldots C_m \right\}</math> | We introduce the shurtcut <math>S_m</math> to denote the system with classes <math>\left\{ C_1 \ldots C_m \right\}</math> | ||
<math> | <math> | ||
\beta_{ S_m } \left( C_m \mapsto C_m \right) | |||
= | |||
\ll | \mathrm{id} \left( \mathrm{dom} \left( \tau_m \right) \right) | ||
\cup | |||
\bigcup_{i=1..\infty} { \beta_{ S_{m-1} } \left( \alpha_{m,i}, \alpha_{m,i} \right) \ll \eta_{m, i}} | |||
</math> | |||
<math> | <math> | ||
| Line 99: | Line 100: | ||
} | } | ||
</math> | </math> | ||
<math>\beta_{ S_m } \left( C_p \mapsto C_q \right) = \beta_{ S_{m-1} } \left( C_p \mapsto C_q \right)</math> for <math>p < m \land q < m</math> | |||
<math> | <math> | ||
Revision as of 17:47, 2 October 2006
Motivation:
Eiffels dynamic binding is somewhat more complex than that of other languages. Its structure is still very simple and can be described by giving the relation:
Relation γ contains both the static and dynamic binding part of the language. In the following feature:
f (a: ANY)
do
print (a.out)
end
The static binding part of call a.out can be decribed as:
Namely an evaluation of γ with a tuple containing the static type of the call and the name. The result of this is a function. This function will be evaluated at runtime and yield the right feature according to the dynamic type of a.
In the rest of this text, the we will show how to construct the relation γ based on any given eiffel system.
Some fundamentals
We introduce the operator as the "ancestor of" and as "descendant of" operator.
Without loss of generality we can say that any Eiffel system is a set of classes such that if . In practice class will allways be class ANY but this is not of importance here.
The function:
Yields the features declared in a given class.
Yields the renamings of the different parent parts by a class:
gives the renamings of the first parent part of class A.
Gives the class from which a given parent part of a class inherits:
Gives the base class of the first parent part of class A.
Gives all the selected feature names of a given class.
Furthermore we give the following shortcuts:
- for
- for
- for
- for
The naming function
In this section the naming function of a system is shown:
Its structure
As a helper function we also need function:
We will give a recursive definition of . Meaning that we will give given that we already now
This is valid since:
Its construction
We introduce the shurtcut to denote the system with classes
for