Newsgroups: comp.lang.modula3 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!decwrl!pa.dec.com!src.dec.com!buschman@tubsibr.uucp From: buschman@tubsibr.uucp (Andreas Buschmann) Subject: DISPOSE statement and other pointer related question To: m3 Message-ID: <9104150951.AA01189@pollux> Keywords: DISPOSE LOCATION Reply-To: buschman@tubsibr.uucp Date: Mon, 15 Apr 91 11:51:17 +0200 Lines: 77 Hi! I tried to place this in comp.lang.modula3, but it bounced, so I retry it via the mailing list. Tschuess Andreas /|) Andreas Buschmann /-|) TU Braunschweig, Germany (West) ^^^^ was bitnet: buschman%tubsibr@dbsinf6.bitnet uucp: buschman@tubsibr.uucp p.s. it bounced at compuserve.com, but I don't know what I have done wrong. so here it is again: 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