DynBindModel: Difference between revisions

From EiffelStudio: an EiffelSoftware project
Jump to navigation Jump to search
Konradm (talk | contribs)
Konradm (talk | contribs)
Line 26: Line 26:
We introduce the operator <math>></math> as the "ancestor of" and <math><</math> as "descendant of" operator.
We introduce the operator <math>></math> as the "ancestor of" and <math><</math> as "descendant of" operator.


Without loss of generality we can say that any Eiffel system <math>S</math> consists of a set of classes  
Without loss of generality we can say that any Eiffel system <math>S</math> is a set of classes  
<math>\left\{ C_1, C_2 \ldots C_n \right\}</math> such that <math>C_q \not< C_p </math> if  <math>q < p</math>. In practice class <math>C_1</math> will allways be class ANY but this is not of importance here.
<math>\left\{ C_1, C_2 \ldots C_n \right\}</math> such that <math>C_q \not< C_p </math> if  <math>q < p</math>. In practice class <math>C_1</math> will allways be class ANY but this is not of importance here.


The relation <math>\tau</math>
The relation <math>\tau</math>


<math>\tau : \mathrm{TYPE} \rightarrow \left( \mathrm{NAME} \rightarrow \mathrm{FEATURE} \right)</math>
<math>\tau_S : \mathrm{TYPE} \rightarrow \left( \mathrm{NAME} \rightarrow \mathrm{FEATURE} \right)</math>


Gives information about the features declared in a class. This relation is explicitely given by the unfolded form of all the classes of a system.
Gives information about the features declared in a class. This relation is explicitely given by the unfolded form of all the classes of a system.

Revision as of 21:56, 1 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:

γ:(TYPE×NAME)→(TYPE→FEATURE)

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:

γ(ANY↦out)

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 S is a set of classes {C1,C2…Cn} such that Cq<Cp if q<p. In practice class C1 will allways be class ANY but this is not of importance here.

The relation τ

τS:TYPE→(NAME→FEATURE)

Gives information about the features declared in a class. This relation is explicitely given by the unfolded form of all the classes of a system.