home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!agate!doc.ic.ac.uk!uknet!bhamcs!axs
- From: axs@cs.bham.ac.uk (Aaron Sloman)
- Newsgroups: comp.lang.pop
- Subject: Re: Dynamic List Implementation
- Message-ID: <BzpFyF.F6t@cs.bham.ac.uk>
- Date: 23 Dec 92 09:06:15 GMT
- References: <116670038@otter.hpl.hp.com>
- Sender: news@cs.bham.ac.uk
- Organization: School of Computer Science, University of Birmingham, UK
- Lines: 46
- Nntp-Posting-Host: emotsun
-
- sfk@otter.hpl.hp.com (Steve Knight) writes:
-
- > Date: 22 Dec 92 14:55:12 GMT
- > Organization: Hewlett-Packard Laboratories, Bristol, UK.
- >
- > I've always been puzzled why POPLOG implements dynamic lists using
- > pairs rather than a separate dpair key. In fact, a dynamic list
- > is represented using a pair whose back is a procedure and whose
- > front is true.
-
- I absolutely agree that this is wrong and wish we had changed it in
- Pop-11 instead of following Pop2, just as we introduced a new
- data-type for undefs and for booleans. (In Pop2, 0 was false, alas.)
-
- I cannot see any reason for the way things are except that the
- original Pop2 was implemented on a tiny machine and a new record
- type would have required an unacceptable amount of additional space
- in the system.
-
- One problem with having a different record type for dynamic lists is
- that if you expand a dynamic list you would then have to change the
- type of the record, since lots of things can be pointing to that
- list. Your message did not point out that one of the consequences of
- applying "null" to a list is that if it is dynamic and non-null it
- gets "solidified" by one step, so that if null(list) returns false
- you can then optimise and apply "front", or even "fast_front" to
- list.
-
- I suspect we would then need three record types
-
- dlist = unexpanded dynamic list
- dnull = empty dynamic list
- pair = static list, or link for expanded part of dynamic
- list.
-
- This is currently handled in Pop11, following Pop2, by changing the
- *contents* of the record holding the dynamic list. Changing the
- type, by changing the key pointer, would be better, allowing faster
- checking.
-
- Aaron
- --
- Aaron Sloman, School of Computer Science,
- The University of Birmingham, B15 2TT, England
- EMAIL A.Sloman@cs.bham.ac.uk OR A.Sloman@bham.ac.uk
- Phone: +44-(0)21-414-3711 Fax: +44-(0)21-414-4281
-