CompuServe Messages

#Typing Philosophy

    25-Sep-87 08:47:52
Sb: #Typing Philosophy
Fm: Tom Cattrall 72767,622
To: Thomas Holaday 70407,534
The 2nd and 3rd editions have the same thing to say on this subject. If you look at sect 9.1 of the report (page 152 2nd ed.), you'll see… Operand types are said to be assignment compatible if either they are compatible or both are INTEGER or CARDINAL or subranges with base types INTEGER or CARDINAL. and in sect 6.3 (page 146) … A type T1 is said to be compatible with a type T0, if it is declared either as T1 = T0 or as a subrange of T0, or if T0 is a subrange of T1, or if T0 and T1 are both subranges of the same (base) type. He doesn't say they are compatible if T1 and T0 have the same structure. My example does show that anonymous types aren't compatible: y is not the same as z1 or z2 even though they have the same structure. Your Cc and DD are compatible because as he says in sect 9.1 they are both of TYPE INTEGER. The way I think of it is that the standard types have been defined already and what you really have is something like … TYPE INTEGER = ——-; CARDINAL = ——-; CHAR = ——-; etc. VAR Cc : INTEGER; DD : INTEGER; And therefore they are both defined using the same type rather than as two separate anonymous types. Tom