home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!root44!hrc63!mrcu!paj
- From: paj@uk.co.gec-mrc (Paul Johnson)
- Newsgroups: comp.lang.eiffel
- Subject: Re: How to design a data structure library
- Message-ID: <1865@snap>
- Date: 30 Jul 92 08:41:42 GMT
- References: <1C20AE2393DF002118@chl.ie>
- Reply-To: paj@uk.co.gec-mrc (Paul Johnson)
- Organization: GEC-Marconi Research Centre, Great Baddow, UK
- Lines: 41
-
- In article <1C20AE2393DF002118@chl.ie> SPARKER@CHL.IE ("Simon Parker, Computer consultant") writes:
-
- >It seems to me that in some circumstances the complexity of managing
- >multiple cursors for a list might be avoided by using shallow copies.
-
- [ie the default behaviour of `copy' on a linked list]
-
- >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.
-
- [...]
-
- > 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 questions are not just philosophical. For instance, suppose I
- insert an element into such a shared list. The `count' of one LIST
- object gets updated but the other does not. If I now iterate through
- the list using the other LIST object I will eventually have
- (position>count+1), which violates the invariant of the LIST.
-
- > The corollary, of course, is that a new element is only visible to
- > the inserter.
-
- I don't understand. If I insert an element into the middle of a
- shared list, how can it not be visible to all the other objects which
- share that list?
-
- Paul.
- --
- Paul Johnson (paj@gec-mrc.co.uk). | Tel: +44 245 73331 ext 3245
- --------------------------------------------+----------------------------------
- These ideas and others like them can be had | GEC-Marconi Research is not
- for $0.02 each from any reputable idealist. | responsible for my opinions
-