[comp.lang.modula3] Bug in Oberon-M

bert@let.rug.nl (Bert Bos) (05/16/91)

While trying to write a Quicksort routine in Oberon-M, I found the
following weird behaviour. Program 1 is incorrect, while program 2 is
accepted by the compiler:

(* 1 *)	MODULE test;			(* this program doesn't compile *)
	TYPE 	Object = POINTER TO ObjectRec;
		ObjectRec = RECORD END;

	PROCEDURE p(VAR x: ARRAY OF Object);
		VAR h: Object;
		    ^^^^^^^^^
		BEGIN  h:= x[0]  END p;

	BEGIN END test.

(* 2 *)	MODULE test2;			(* this program does compile *)
	TYPE	Object = POINTER TO ObjectRec;
		ObjectRec = RECORD END;

	PROCEDURE p(VAR x: ARRAY OF Object);
		VAR h: ObjectRec;
		    ^^^^^^^^^^^^
		BEGIN  h:= x[0]  END p;

	BEGIN END test2.

Is this a bug, or is Oberon supposed to treat arrays of pointers as
arrays of records? If it isn't a bug, how else do you create an array
of elements of unspecified (i.e. extended) type?
-- 
  "The Door is the Way.                           Bert Bos (bert@let.rug.nl)
   Capital letters are always the best way of     Alfa-informatica
   dealing with things you don't have a good      RijksUniversiteit Groningen
   answer to. (Douglas Adams: Dirk Gently's...)"  Groningen, The Netherlands