home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!cf-cm!news
- From: SPARKER@CHL.IE ("Simon Parker, Computer consultant")
- Newsgroups: comp.lang.eiffel
- Subject: How to design a data structure library
- Message-ID: <1C20AE2393DF002118@chl.ie>
- Date: 28 Jul 92 08:19:00 GMT
- Sender: news@cm.cf.ac.uk (Network News System)
- Organization: University of Wales College of Cardiff, Cardiff, WALES, UK.
- Lines: 41
- X-Envelope-To: comp.lang.eiffel@cm.cf.ac.uk
- X-Vms-To: IN%"comp.lang.eiffel@cm.cf.ac.uk"
- X-Mailer: Cardiff Computing Maths PP Mail Open News Gateway
-
-
- [Reference the discussion on data structure library design, specifically
- the question of list cursors]
-
- It seems to me that in some circumstances the complexity of managing
- multiple cursors for a list might be avoided by using shallow copies.
-
- I'm not sure which variant of 'copy' I mean, but it's the one which
- produces a new list and a new set of 'linkables' without copying
- the contents.
-
- Instead of regarding the list as the shared object and the cursors
- as private access mechanisms, think of the list elements as shared
- and the list itself as a private access mechanism.
-
-
- There are a number of advantages of this approach.
-
- One cursor per list will suffice, preserving the elegance of the
- 'active structure' concept.
-
- Each accessor has a full set of list features, including count,
- insert, remove.
-
- Interference between multiple inserters and the philosophical questions
- about versions go away. The corollary, of course, is that a new element
- is only visible to the inserter.
-
- Similarly with deletion - the thing the element references doesn't
- get deleted, it just gets detached from the deleter's list. Again,
- it's still in the other lists.
-
- Modification of an object which appears in multiple lists is arbitrated
- by the object, rather than by the lists or cursors.
-
- There are of course disadvantages which make the approach unsuitable
- in many circumstances. If a shared list is what you need copies won't
- help, and I don't see how this could work with expanded types. It
- is easy to find situations in which the advantages turn into disadvantages!
-
- Does this have merit, or am I being naive?
-