[Oberon] Clarifying type compatibility in Oberon-07

August Karlstrom fusionfile at gmail.com
Thu Oct 5 09:19:11 CEST 2017


On 2017-10-04 22:27, Jörg wrote:
>> Am 04.10.2017 um 21:00 schrieb August Karlstrom <fusionfile at gmail.com>:
>> * Since integers and integer variables can be assigned to byte variables the type inclusion concept makes no sense in Oberon-07. It should be dropped from the appendix.
> 
> I’m open to that point. I liked the idea of inclusion. E.g. what is the type of c in CONST c = 30; ? Is it BYTE or is INTEGER?
> This was the reason why I let it in, but restricted it to integer type and adapted rule Assignment 2 accordingly. But feel free.

The type of 30 is INTEGER and therefor the type of c is also INTEGER. 
Note that there are no BYTE literals.

>> * Under "Assignment compatible" you don't mention assignment of open arrays.
> 
> open arrays only exist as formal parameter of a procedure not as a variable. Assignment rules are for variables. In my point of view open arrays are covered in Array rule 2.

I'm talking about paragraph 4 in section 9.1 of the Oberon-7 language 
report:

	http://miasap.se/obnc/oberon-report.html#sec9

>> * Paragraph 4 of "Array compatible" (ARRAY n OF BYTE...) must be a compiler extension since it cannot be deduced from the language report.
> 
> That’s indeed strange. In one of the previous posts Chris highlighted that this was possible. I was not aware of this and was thinking the same. If I remember correctly, I browsed then thru the report and indeed found a sentence explicitly mentioning it. I re-did that today, I can’t find it back anymore. Seems, I’m getting old… Feel free to delete it. I have to admit it’s a feature that simplifies things. It frees your (low level) code of a lot of SYSTEM.VAL(LONGINT, …)

OK, we will wait for Chris and see what he has to say about it.

>> You never mention structural equivalence in assignment of expressions of array or procedure type, so the question is if that is an undocumented "language extension" in the PO2003 compiler.
> 
> In my point of view this topic is covered by the last chapter titled „Matching formal parameter lists"
If I understand correctly, with the variable declarations

	a: ARRAY 10 OF INTEGER
	b: ARRAY 10 OF INTEGER
	p: PROCEDURE
	q: PROCEDURE

The following assignments are accepted by the PO2003 compiler:

	a := b
	p := q

How is this covered by the rules in "Matching formal parameter lists"? 
This is not related to procedure calls.


-- August


More information about the Oberon mailing list