Post by August KarlstromPost by Chris BurrowsOn further investigation, according to Section 9.2.1 'Extension of pointer
types' in 'Programming in Oberon' by Reiser and Wirth my definition of List
----------------------------------
...
Note that the node type (NodeDesc) must be explicit to avoid an illegal
Node = POINTER TO RECORD key: Key; next: Node END;
...
----------------------------------
It's strange then that ETH Oberon, which I have considered to be the
reference implementation, allows it.
Allows it or does not prohibit it? That is the real question. This is one of
those cases where the declaration is syntactically correct, but (possibly)
not semantically correct.
Post by August KarlstromAlso, section 21 of Programming in Oberon(1) (a PDF version different from
TYPE Item = POINTER TO RECORD
num: INTEGER; next: Item
END;
That is a different book altogether and does not have Martin Reiser as
co-author with Wirth. It is actually an Oberon version of the primary
Modula-2 reference book 'Programming in Modula-2' (a.k.a. PIM). I would
consider the Oberon translation to be a very rough draft as it contains many
inaccuracies. You should use it as a guide not a definitive reference.
Strangely though, the 1982 Modula-2 version that I have does have the extra
declaration:
ListPtr = POINTER TO Item;
and 'next' is a ListPtr.
Post by August Karlstromoriginal A PDF with slide notes from University of California, San
Diego(2) also discusses recursive records under the assumption that the
above construct is indeed valid; "Partly-declared records are okay as
POINTER
types."
Note also that section 4 in the Oberon-2 report is a bit vague about these
"A type T of the form POINTER TO T1 (see 6.4) can be declared at a point
where T1 is still unknown. The declaration of T1 must follow in the same
block to which T is local"
"If a type T is defined as POINTER TO T1 (see 6.4), the identifier T1 can
be declared textually following the declaration of T, but it must lie
within the same scope."
Should we interpret this as a clarification in the Obeoron-07 report that
declarations like the one above are not valid?
Possibly.
I have recently formed the opinion that any particular advantage that
anonymous pointer types might have, may not be worth the additional
implementation effort. Also the advantages may well be negated by the
disadvantages as they can cause the sort of confusion / vacillation
evidenced in this discussion.
If you are interested in others' opinions try posting your questions in the
Oberon Community Platform Forum as well. There seems to be more activity
there:
http://www.ocp.inf.ethz.ch/forum/
and also on the ETH Mailing list:
https://lists.inf.ethz.ch/mailman/listinfo/oberon
Regards,
Chris