Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!math.fu-berlin.de!uniol!unido!infbs!tubsibr!buschman From: buschman@tubsibr.uucp (Andreas Buschmann) Newsgroups: comp.lang.modula3 Subject: DISPOSE statement and other pointer related question Keywords: DISPOSE LOCATION Message-ID: <1991Apr10.152310.28913@tubsibr.uucp> Date: 10 Apr 91 15:23:10 GMT Sender: buschman@tubsibr.uucp (Andreas Buschmann) Organization: TU Braunschweig, Informatik (Bueltenweg), Germany Lines: 57 Hallo, In the Modula3 report Page 49: A DISPOSE Statement has the form: DISPOSE (v) where v is a writable designator with a fixed or object reference type. If v is untraced, the statement frees the storage for v's referent and sets v to NIL. Freeing storage to which active references remain is an unchecked runtime error. (a) If v is traced, the statement is equivalent to v := NIL. If v is NIL, the statement is a no-op. (b) Two questions rise here: a) is this an unchecked runtime error if and only if v is untraced, or is it one if v is traced, too? b) is this if and only if v is tracedm or if it is untraced, too? As I'm writing an interpreter for a subset of Modula3, the answer is at least interesting for the memory management. Ah, some additional questions: - is (a) the reason for DISPOSE beeing an unsafe operation? - is there a version of the repost in ascii, or dvi format to filter through dvi2tty, to get a report I can grep in? - I have't found a save way (without using unsafe features) getting a checked reference onto a variable, or on a part of a structure or array. I wan't the same effect as in ALGOL68 writing: INT ii := 20; REF INT iii := ii; write (iii) which doesn't make much at the first glance, but is necessary for some iterative rewritings of recursive algorithms for linked list inserting. For my interpreter I created a procedureal operator LOCATION: LOCATION (VAR x: Any) : REF Any How is this supposed to go in the new standard? I am not so happy with th long name LOCATION, but dont want to use the abbeviation LOC because of its different meaning in Algol68 as a local storage allocator in contrast to HEAP, which is semantically equivalent to NEW in m3. Tschuess Andreas