## 160 Pascal Report 

## 6.5. Type Compatibility 

Hue = set of Color; Shape = (Triangle, F ,,:t.angle, Circle); Year = 1900 .. 2100; Card = array [1. .80) )f Char; String18 = packed ar lj [1 .. 18) of Char; Complex = record Re, IT: Real end; PersonPointer = "Per 1r~; Relationship = (Marr .d, Coupled, Single); Person = record Name, Firstname: 3tring18; BirthYear: Year; Sex: (Male, Femal,,); Father, Mother: F'rsonPointer; Friends, Childrer.: file of PersonPointer; ExRelationshipCou .t: Natural; case Status: Relati nship of Married, Coupled: (SignificantOth· :-: PersonPointer); Single: ( ) end; Matrixlndex 1 .. N; SquareMatrix = array [I it rixlndex, Matrixlndex) of Rei I; 

Two types are said to be compufihle if any of the following four conditions is true. 

(a) They are the same type. 

(b) One is a subrange of the other. or both are subranges of the same host type. 

(c) Both are set types, their rase types are compatible, and either both are packed or Ilcither is packed. 

(d) Both are string types with Ihe same number of elements. 

A type is called assignable if it "neither a file type nor a structured type with a component type that is 1101 assignable. 

A value possessing type T 2 is C,' lied assignment-compatible with a type T 1 if any of the following fOll" conditions is true. 

(a) T1 and T2 are the same as, ignable type. 

(b) T1 is Real and T2 is Integ,r. 

(c) T1 and T2 are compatible (rdinal types or compatible set types, and the value is a I nember of the set of values determined by T 1. 

(d) T1 and T2 are compatible ~,Iring types. 

