Glossary¶
Note
Work in Progress!
Dynamic Dispatching¶
Dynamic Dispatching is the mechanism that determines which primitive needs to be called for an object instance when this object is part of a class hierarchy. This always happens when the compiler cannot figure this out during compile time. In such cases, dynamic dispatching must do it at runtime, because the actual type of an object can differ from the declared type. This is a key feature that allows runtime polymorphism.
Controlling Parameter¶
The parameter that links a primitive subprogram to a tagged record. is the parameter of a tagged type that determines which version of a dispatching operation gets called at runtime.
Controlling Parameter¶
1type Person is tagged record
2 name : String;
3 age : Integer;
4end record;
5type Person_Access is access all Person;
6
7-- Greet1 and Greet2 are dispatchable primitives. Both have a tagged record as
8-- its first argument. So if foo is of Type Person, you can call foo.Greet1;
9-- or Greet1(foo);
10procedure Greet1(Self : in out Person);
11procedure Greet2(Self : access Person);
12
13-- Greet3 is not dispatchable, because Person_Access is its own type and is not
14-- a tagged type. It only accesses a tagged type, which in Ada's strict type system
15-- is a different thing.
16procedure Greet3(Self : Person_Access);