Dynamic typing subsumes sub typing and provide for the integration of object-oriented concepts and Algol-style languages in a natural way. For example
Suppliers : set ofcan be seen as the declaration of an object class and
Parts-supplied : Suppliers set of Partscan be seen as the declaration of a member variable for class Suppliers. Dynamically creating new abstract values and including them in set Suppliers amounts to dynamically creating objects of class Suppliers.
Derived classes correspond to subtypes, and inheritance follows naturally. For example, given type (class) , an operator (method) , and a subtype (derived class) , then may obviously be applied to arguments of type . Moreover, the value resulting from the application of to arguments of type may well be a member of and thus may be assigned to a variable of type , subject to a ``run-time'' type check. In other words, subtype (derived class) effectively inherits operator (method) from supertype (super class) .
Inherited methods can be overridden by allowing operators (methods) to be overloaded. However, operator/function names cannot be as freely overloaded as in a language like Ada. For example, if
: , : , and = {ab}then it is impossible to determine which must be used when one encounters (ab).
Similar difficulties arise in object-oriented languages that allow multiple inheritance and similar solutions can be adopted.
Prof Herman Venter