Article View: comp.lang.modula2
Article #4821Re: Recursive data types
From: Robert Marti
Date: Fri, 12 May 1989 07:50
Date: Fri, 12 May 1989 07:50
37 lines
1925 bytes
1925 bytes
In articles <5734@cs.Buffalo.EDU> and <5760@cs.Buffalo.EDU>, ugprussa@cs.Buffalo.EDU (Michal Prussak) writes: > Wirth describes in his book "Algorithms and Data Structures" (from 1986) > a recursive data type (p 173). > [ ... ] > Does anybody know of a compiler that implements this? Or is this example > for future versions of Modula? and > I agree that this should not work, but... > Wirth not only seems to imply that this should work, but he also gives > a diagram of internal representation of such record. I don't think he implies that it should work. In fact, p.175 of the very same book states (quoted without permission): The characteristic property of recursive structures [ ... ] is their ability to vary in size. Hence, it is impossible to assign a fixed amount of storage to a recursively defined structure, and as a consequence a compiler cannot associate specific addresses to the components of such variables. The technique most commonly used to master this problem involves _dynamic allocation_ of storage [ ... ]. I don't think there is a Modula-2 compiler that implements recursive data types _directly_, although it could be done. Indeed, someone in Wirth's group has developed an experimental language, Mona, which supports recursive data types (TREE types). Mona is _not_ a superset of Modula-2, though. -- 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
Technical Details
Message-ID:
<867@ethz.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!cernvax!ethz!martiReferences:
<5734@cs.Buffalo.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!cernvax!ethz!marti From: marti@ethz.UUCP (Robert Marti) Newsgroups: comp.lang.modula2 Subject: Re: Recursive data types Message-ID: <867@ethz.UUCP> Date: 12 May 89 07:50:45 GMT References: <5734@cs.Buffalo.EDU> Organization: ETH Zuerich Lines: 37