Type Inclusion

next up previous contents index
Next: Assignment Up: Assignment Previous: Assignment

Type Inclusion

Based on the declared types of variables and routine headers, the compiler can compute a type for any expression; we refer to this type as the apparent type, as opposed to the actual type of the object that results when the expression is evaluated at run time. The actual type is always a subtype of the apparent type.

An assignment

        v := e
is legal if and only if the apparent type of expression [tex2html_wrap2899] is a subtype of the type of variable [tex2html_wrap2901]. Thus, the compiler guarantees that for any initialized variable [tex2html_wrap2903], the type of the object referred to by [tex2html_wrap2905] is a subtype of the type of [tex2html_wrap2907].