Xref: utzoo comp.lang.modula2:3952 comp.lang.modula3:249 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!uunet!mcsun!hp4nl!let.rug.nl!bert From: bert@let.rug.nl (Bert Bos) Newsgroups: comp.lang.modula2,comp.lang.modula3 Subject: Bug in Oberon-M (MS-DOS)? Keywords: ARRAY OF pointertype Message-ID: <1707@gufalet.let.rug.nl> Date: 16 May 91 12:02:18 GMT Followup-To: comp.lang.modula2 Organization: Faculty of Arts, Groningen University, The Netherlands Lines: 35 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