[Oberon] Clarifying type compatibility in Oberon-07
joerg.straube at iaeth.ch
Thu Oct 5 17:25:20 CEST 2017
Of course we could do so, but I wonder why?
If I understand you correctly you want to allow the following
a: ARRAY 30 OF CHAR;
b: ARRAY 30 OF CHAR;
a := b;
Currently, this is not allowed, because there are several ways to allow this already
VAR a, b: ARRAY 30 OF CHAR;
TYPE String30 = ARRAY 30 OF CHAR;
We should not change the language. At least not in this case. What could be a practical benefit of it?
NW allows assignment of different ARRAY types only in case of open arrays. This is reasonable as the formal parameter accepts different types.
PROEDURE Test(VAR open: ARRAY OF CHAR);
VAR local: ARRAY 17 OF CHAR;
local := open (* exception allowed by report *)
open := local (* not allowed. Here we could discuss whether we should allow this as well *)
Von: Oberon <oberon-bounces at lists.inf.ethz.ch> im Auftrag von Andreas Pirklbauer <andreas_pirklbauer at yahoo.com>
Antworten an: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
Datum: Donnerstag, 5. Oktober 2017 um 16:38
An: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
Betreff: Re: [Oberon] Clarifying type compatibility in Oberon-07
*8. Tv is ARRAY n OF Ta, e is ARRAY OF Tb, where Ta and Tb are the same type
On 05 Oct 2017, at 16:31, Andreas Pirklbauer <andreas_pirklbauer at yahoo.com> wrote:
> On Thu Oct 5 12:52:20 CEST 2017 Jörg joerg.straube at iaeth.ch wrote:
> Assignment rule 1 uses „same type". The things NOT covered by „same type“ are mentioned explicitly with own assignment rules.
> 4. Ta and Tb are pointer types whose pointer base types are the same, or
> This rule is not needed, as it is covered by Assignment rule 4, assuming T is an extension of T itself.
> 5. Ta and Tb are procedure types whose formal parameter lists match.
> This rule is not needed as it covered by Assignment rule 7.
Ok. So these two proposed rules are not needed (assuming T is an extension of T itself).
While we are at it, what about the following similar rules for arrays (changes are marked with an asterisk * below). Would these be covered by the existing type rules and/or can these be derived from the language report? If these rules cannot be derived from the language report, should the language itself be extended?
Two variables a and b with types Ta and Tb are of the same type if
*4. Ta and Tb are array types with same element types and lengths
An expression e of type Te is assignment compatible with a variable v of
type Tv if one of the following conditions hold:
*8. Tv is ARRAY OF Ta, e is ARRAY OF Tn, where Ta and Tb are the same types
-- Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Oberon