🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2235

Bug in Oberon-M (MS-DOS)?

#2235
From: Bert Bos
Date: Thu, 16 May 1991 12:02
35 lines
1627 bytes
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
Technical Details
Message-ID: <1707@gufalet.let.rug.nl>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!uunet!mcsun!hp4nl!let.rug.nl!bert

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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