[Oberon] Clarifying type compatibility in Oberon-07
chris at cfbsoftware.com
Sat Oct 7 06:47:54 CEST 2017
> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Diego Sardina
> Sent: Saturday, 7 October 2017 4:38 AM
> To: oberon at lists.inf.ethz.ch
> Subject: Re: [Oberon] Clarifying type compatibility in Oberon-07
> On Fri, Oct 6, 2017, at 06:32 PM, Luca Boasso wrote:
> > I have found and old email where I asked Prof. Wirth the following:
> > "I would like to know the reasoning behind the departure from array
> > name equivalence in favour of array structural equivalence. i.e
> > these two types are equivalent in Oberon-07 but not in Oberon-90
> > TYPE A = ARRAY 3 OF INTEGER;
> > B = ARRAY 3 OF INTEGER;
> > Could you explain why you decided to change the language in this
> > He replied saying that he does not remember the the exact
> circumstances, as the change was several years ago.
> > He continued that the most obvious reason is that one needs less
> often to declare named types.
> During 2008 Wirth was experimenting structural equivalence in the
> case of arrays.
> Oberon-07 report of 1.11.2008 had this exception in 9.1. Assignments:
> 2. Arrays must have the same element type, and the length of the
> destination array must not be less than the length of the source
> This sentence was changed often in that period, maybe he was
> experimenting also structural equivalence between procedure
> Later this sentence was removed, but he didn't update the compiler (I
As discussed in comp.lang.oberon he didn't update section 4.1 of the following document either:
"Differences between Revised Oberon and Oberon".
"But now we handle array and record assignments just like other assignments, writing dst := src, and discard the COPY procedure. The destination array must not be shorter than the source array. This is in accordance with the assignment rule for strings and with the compatibility of record types and their extensions."
You can download a copy from:
This was explained in more detail in section 18. 'Assignment of Arrays' in the 2008 document 'An Oberon Compiler for the ARM Processor' which the Astrobe Oberon compiler originated from.
"In contrast to original Oberon, where a (the) standard procedure COPY is used, the “:=” symbol now also applies to arrays and strings."
"The arrays must have the same element type, but the source array may be shorter than the destination array. Hence, the length (count) is taken from the source. The length comparison is performed by the compiler. This is not possible in the case of open arrays, when the check must be performed at run-time. (Currently, only the source may be an open array)."
However, dynamic array variables were also implemented in that compiler. As they are not included in Oberon-07, the structural equivalence of arrays used in assignments is a less useful feature.
More information about the Oberon