[Oberon] Clarifying type compatibility in Oberon-07
joerg.straube at iaeth.ch
Thu Oct 5 11:50:58 CEST 2017
** On the other hand, I can’t find where your example of a := b is mentioned in the Oberon-07 report (independent of the fact that the compiler
** Neither can I. However, sometimes a rule is implied by some other rule.
** That's why I ask for help here.
We have to define whether NWs compiler is the master or the NWs report is the master. NW seems to like the idea that source code is the most accurate documentation… :-P
* I guess In fact, also pointers are structurally
* equivalent in PO2003 in the sense that the compiler (if I'm not
* mistaken) accepts a module like this:
* MODULE M;
* T = RECORD END;
* p: POINTER TO T;
* q: POINTER TO T;
* p := q
* END M.
This assignment of POINTERs is in my point of view somehow covered already by the extension definition. T can be seen as the simplest form of the extension of T itself.
* This seems to be the definition of *same type* in PO2003:
* 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, or
* 4. Ta and Tb are array types whose element types and lengths are the
* same, or
No evidence in the report. Perhaps a sloppy implementation of the open array assignment thing.
* 5. Ta and Tb are pointer types whose pointer base types are the same, or
covered by the extension rule as I see the base type is the simplest form of an extension of itself
* 6. Ta and Tb are procedure types whose formal parameter lists match.
Isn’t this covered by Assignment rule 7
More information about the Oberon