Compatible types
Irie Pascal implements the type compatibility rules defined by Standard Pascal (ISO/IEC 7185),
and adds one more rule to support variable length string types. The first four rules below
are taken from ISO/IEC 7185 and the last rule is added to support variable length string types.
Types T1 and T2 shall be designated compatible if any of the following statements is true:
- T1 and T2 are the same type.
- T1 is a subrange of T2, or T2 is a subrange of T1, or both T1 and T2 are subranges of
the same host type.
- T1 and T2 are set-types of compatible base-types, and either both T1 and T2 are
designated packed or neither T1 nor T2 is designated packed.
- T1 and T2 are fixed-length-string-types with the same number of components.
- Either T1 is a variable-length-string-type and T2 is a variable-length-string-type, or
T1 is a variable-length-string-type and T2 is a fixed-length-string-type, and the number of
components in T2 is less than or equal to the maximum length of T1, or T1 is a
variable-length-string-type and T2 is the char-type or T2 is a variable-length-string-type
and T1 is a fixed-length-string-type, and the number of components in T1 is less than or
equal to the maximum length of T2, or T2 is a variable-length-string-type and T1 is the
char-type.