home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / object / 3015 < prev    next >
Encoding:
Internet Message Format  |  1992-07-27  |  3.5 KB

  1. Xref: sparky comp.object:3015 comp.lang.eiffel:986
  2. Path: sparky!uunet!mcsun!corton!irisa!irisa.fr!jezequel
  3. From: jezequel@irisa.fr (Jean-Marc Jezequel)
  4. Newsgroups: comp.object,comp.lang.eiffel
  5. Subject: Re: How to design a data structure library.
  6. Message-ID: <1992Jul27.123345.9183@irisa.fr>
  7. Date: 27 Jul 92 12:33:45 GMT
  8. References: <1820@snap>
  9. Sender: news@irisa.fr
  10. Organization: Irisa, Rennes(FR)
  11. Lines: 67
  12.  
  13. In article <1820@snap>, paj@uk.co.gec-mrc (Paul Johnson) writes:
  14.  
  15. |> Cursors
  16. |> -------
  17.     This is a complicated issue, and I think more research should be made before
  18. having to choose on one of the proposed issues, most notably at the semantic level.
  19. Howver, I would like to make 2 remarrks:
  20.     1) cursors (or iterators) should be independant of the underlying data structure
  21. aggregate. Here I find the SmallTalk concept of Collection usefull, with array and list
  22. and set and others inheriting from it (with possible intermediate classes, like
  23. OrderedCollection). Iterators should be defined on Collections, and possibly redefined in
  24. subclasses for efficiency issues.
  25.     2) User interface of the cursor notion should be very simple because otherwise
  26. nobody will use it, as writing an had hoc loop is so deeply built-in the mind of the
  27. average programmeur.
  28. |> 
  29. |> RISC vs CISC
  30. |> ------------
  31.     I am for CISC, as selecting is always easier than building.
  32. |> 
  33. |> Functional vs Procedural
  34. |> ------------------------
  35. |> Does it make sense to implement both kinds of operations in a class,
  36. |> so that the programmer can pick the appropriate one?
  37.  
  38. YES, absolutely. I think it should be the rule.
  39. Furthermore, it is not very hard to implement.
  40. For instance, your set example could be programmed like this:
  41.  
  42. UnionWith (other:like current) is
  43.   --perform the operation Current := Current Union other
  44.   --in an efficient way, by modifying directly Current
  45.   -- (the name of this feature in Eiffel 2.3 is "merge")
  46. end;
  47.  
  48. infix "+" (other:like current):like current is
  49.   do Result.clone(Current); Result.UnionWith(other); end;
  50.  
  51. I can't see any disavantage of this approach (even for efficiency reasons, as an Eiffel
  52. compiler could do the inline expansion of infix "+" --I think ISE 2.3 does it already).
  53. Pros are:
  54. - algorithm complexity  should be the same than a direct solution for infix "+"
  55. - this works for a lot of data structures (think of matrix computations for example)
  56. - the clone trick allows one the deal with deferred and generaic classes, wheras you
  57. couldn't create instances of such classes, as needed with a direct solution (Result.Create
  58. is rejected by the compiler in such cases).
  59. -I am not sure, but in Eiffel 3 the feature UnionWith could have a prefix syntax (a la C):
  60.  infix "|+=" (other:like current) is...
  61.  (Is it true for procedure features? I can't see why it shouldn't, but I did'nt saw it
  62. explicitely in ETL)
  63.  
  64. |> Documentation
  65. |> -------------
  66. Why not using a relationnal database?
  67. Or at least the Unix "man" facility with one man page (in a special section) for
  68. each class, an another one for each Cluster, all of it with a good use of the "keywords"
  69. field to work with: man -k
  70. This should be simple (the tool is there) and nearly automatic: the man page could be
  71. extracted from the text of the class, as for tools like short and flat.
  72.  
  73. Sure it would be the role of NICE to propose a "standard" solution at that level.
  74.  
  75.  
  76. -- 
  77. +----------------------------------------------------------------------------+
  78. | Jean-Marc Jezequel, IRISA/CNRS, 35042 RENNES (FRANCE) // jezequel@irisa.fr |
  79. +----------------------------------------------------------------------------+
  80.