home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / eiffel / 1024 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  1.9 KB

  1. Path: sparky!uunet!mcsun!uknet!root44!hrc63!mrcu!paj
  2. From: paj@uk.co.gec-mrc (Paul Johnson)
  3. Newsgroups: comp.lang.eiffel
  4. Subject: Re: How to design a data structure library
  5. Message-ID: <1865@snap>
  6. Date: 30 Jul 92 08:41:42 GMT
  7. References: <1C20AE2393DF002118@chl.ie>
  8. Reply-To: paj@uk.co.gec-mrc (Paul Johnson)
  9. Organization: GEC-Marconi Research Centre, Great Baddow, UK
  10. Lines: 41
  11.  
  12. In article <1C20AE2393DF002118@chl.ie> SPARKER@CHL.IE ("Simon Parker, Computer consultant") writes:
  13.  
  14. >It seems to me that in some circumstances the complexity of managing
  15. >multiple cursors for a list might be avoided by using shallow copies.
  16.  
  17. [ie the default behaviour of `copy' on a linked list]
  18.  
  19. >Instead of regarding the list as the shared object and the cursors
  20. >as private access mechanisms, think of the list elements as shared
  21. >and the list itself as a private access mechanism.
  22.  
  23.  
  24. >There are a number of advantages of this approach.
  25.  
  26. [...]
  27.  
  28. > Each accessor has a full set of list features, including count,
  29. > insert, remove.
  30.  
  31. > Interference between multiple inserters and the philosophical questions
  32. > about versions go away.
  33.  
  34. The questions are not just philosophical.  For instance, suppose I
  35. insert an element into such a shared list.  The `count' of one LIST
  36. object gets updated but the other does not.  If I now iterate through
  37. the list using the other LIST object I will eventually have
  38. (position>count+1), which violates the invariant of the LIST.
  39.  
  40. > The corollary, of course, is that a new element is only visible to
  41. > the inserter.
  42.  
  43. I don't understand.  If I insert an element into the middle of a
  44. shared list, how can it not be visible to all the other objects which
  45. share that list?
  46.  
  47. Paul.
  48. -- 
  49. Paul Johnson (paj@gec-mrc.co.uk).        | Tel: +44 245 73331 ext 3245
  50. --------------------------------------------+----------------------------------
  51. These ideas and others like them can be had | GEC-Marconi Research is not
  52. for $0.02 each from any reputable idealist. | responsible for my opinions
  53.