DynBindModel: Difference between revisions

From EiffelStudio: an EiffelSoftware project
Jump to navigation Jump to search
Konradm (talk | contribs)
Konradm (talk | contribs)
Line 3: Line 3:
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 γ:
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 γ:


<math>\gamma : (\mathrm{TYPE} \times \mathrm{NAME}) \rightarrow  (\mathrm{TYPE} \rightarrow \mathrm{NAME}) </math>
<math>\gamma : (\mathrm{TYPE} \times \mathrm{NAME}) \rightarrow  (\mathrm{TYPE} \rightarrow \mathrm{FEATURE}) </math>
 
Relation γ contains both the static and dynamic binding part of the language. In the following feature:
 
<code>[N,Eiffel]
f (a: ANY)
  do
      print (a.out)
  end
</code>
 
The static binding part of call a.out can be decribed as:
 
<math>\gamma \left( \mathrm{ANY} \mapsto \mathrm{out}\right)</math>
 
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.

Revision as of 21:15, 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.