[Oberon] Clarifying type compatibility in Oberon-07

August Karlstrom fusionfile at gmail.com
Thu Oct 5 12:30:40 CEST 2017


On 2017-10-05 11:50, Jörg wrote:
> We have to define whether NWs compiler is the master or the NWs report is the master.

The language report is the master according to NW and this is of course 
how it should be.

> * 	MODULE M;
> * 	
> * 		TYPE
> * 			T = RECORD END;
> * 	
> * 		VAR
> * 			p: POINTER TO T;
> * 			q: POINTER TO T;
> * 			
> * 	BEGIN
> *  		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.

It's the "in my point" and "somehow" we want to avoid and instead have a 
clear and complete definition of type compatibility like Oberon-2 has.

> *    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.

Yes maybe, but at least Chris (one of the master interpreters of NW's 
writings) claims, if I understand him correctly, that it's somehow 
implied by paragraph 9.1.4:

	"An open array may be assigned to an array of equal base type."

> *    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

So this is your understanding of *same type* in Oberon-07:

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 pointer types whose pointer base types are the same, or
5. Ta and Tb are procedure types whose formal parameter lists match.



-- August


More information about the Oberon mailing list