Clarifying type compatibility in Oberon-07
On Wed Oct 4 08:37:50 CEST 2017 August Karlstrom wrote: Oberon-2 has the following definition of *same type* in appendix A in the language report:
Two variables a and b with types Ta and Tb are of the same type if 1. Ta and Tb are both denoted by the same type identifier, or 2. Ta is declared to equal Tb in a type declaration of the form Ta = Tb, or 3. a and b appear in the same identifier list in a variable, record field, or formal parameter declaration and are not open arrays.
As far as I understand, Oberon-07 uses structural equivalence for array and procedure types so we must add two paragraphs to this list:
4. Ta and Tb are array types whose element types and lengths are the same, or 5. Ta and Tb are procedure types whose formal parameter lists match.
These two sentences are actually part of the definition of “Equal types”: Equal types Two types Ta and Tb are equal if 1. Ta and Tb are the same type, or 2. Ta and Tb are open array types with equal element types, or 3. Ta and Tb are procedure types whose formal parameter lists match. -AP
EDIT: Except of course that in the case of the definition of “equal types” Ta and Tb are *open* array types.
On 05 Oct 2017, at 10:58, Andreas Pirklbauer <andreas_pirklbauer@yahoo.com> wrote:
On Wed Oct 4 08:37:50 CEST 2017 August Karlstrom wrote: Oberon-2 has the following definition of *same type* in appendix A in the language report:
Two variables a and b with types Ta and Tb are of the same type if 1. Ta and Tb are both denoted by the same type identifier, or 2. Ta is declared to equal Tb in a type declaration of the form Ta = Tb, or 3. a and b appear in the same identifier list in a variable, record field, or formal parameter declaration and are not open arrays.
As far as I understand, Oberon-07 uses structural equivalence for array and procedure types so we must add two paragraphs to this list:
4. Ta and Tb are array types whose element types and lengths are the same, or 5. Ta and Tb are procedure types whose formal parameter lists match.
These two sentences are actually part of the definition of “Equal types”:
Equal types Two types Ta and Tb are equal if
1. Ta and Tb are the same type, or 2. Ta and Tb are open array types with equal element types, or 3. Ta and Tb are procedure types whose formal parameter lists match.
-AP
participants (1)
-
Andreas Pirklbauer