Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde!uunet!mcsun!cernvax!ethz!marti From: marti@ethz.UUCP (Robert Marti) Newsgroups: comp.lang.modula2 Subject: Re: MetCom (actually: NEW & DISPOSE) Message-ID: <2736@ethz.UUCP> Date: 5 Dec 89 17:11:07 GMT References: <891204.13351181.096571@UWEC.CP6> Organization: ETH Zuerich Lines: 53 In article <891204.13351181.096571@UWEC.CP6>, S703975@UWEC.BITNET (ANDREW TREMBLEY) writes: > My problem is that whenever I try a NEW or a DISPOSE the compiler barfs. > I assume that this is because it has to be imported from a module, but > I have no idea which one. Let me start with a disclaimer: I have never used MetCom Modula-2. I do know a couple of other Modula-2 implementations though, in particular the MacMETH system on which MetCom M-2 is based, I believe. The book "Programming in Modula-2, 3rd Ed." by N.Wirth, p.76, states (emphasis added by me): [Pointer variables] are created by a call of an allocation procedure, usually available from a library module. TYPICALLY, a module Storage may provide a procedure Allocate. The state- ment Allocate(p0, SIZE(Node)) then creates a variable of type Node and assigns a pointer pointing to that variable to [...] p0. and, a little later: In SOME implementations, the statement Allocate(p0, SIZE(Node)) can be abbreviated as NEW(p0) . Assuming that this is all true for MetCom M-2 -- which may well not be the case -- you'd have to import Allocate from Storage anyway, EVEN WHEN using the abbreviation NEW. However, it is not entirely clear which of the two solutions below work: FROM Storage IMPORT Allocate; VAR p: POINTER TO ... ; ... NEW(p); or IMPORT Storage; VAR p: POINTER TO ... ; ... NEW(p); Note that in the MacMETH system, there is a module Storage which exports ALLOCATE (!) and DEALLOCATE and a module System (!) which exports Allocate and Deallocate. NEW is not supported. So, check the documentation to figure out from which module either Allocate or ALLOCATE is exported. Then check if NEW is supported. I hope this helps. -- Robert Marti Phone: +41 1 256 52 36 Institut fur Informationssysteme ETH-Zentrum CSNET/ARPA: marti%inf.ethz.ch@relay.cs.net CH-8092 Zurich, Switzerland UUCP: ...uunet!mcvax!ethz!marti