home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / eiffel / 1365 < prev    next >
Encoding:
Text File  |  1992-12-12  |  2.6 KB  |  105 lines

  1. Newsgroups: comp.lang.eiffel
  2. Path: sparky!uunet!mcsun!julienas!babbage!ensl!lapin!lprylli
  3. From: lprylli@ens-lyon.fr (Loic Prylli)
  4. Subject: Re : joining in 2.3
  5. Message-ID: <Bz5D3n.7F4@ens-lyon.fr>
  6. Sender: news@ens-lyon.fr
  7. Reply-To: lprylli@ens-lyon.fr
  8. Organization: Ecole Normale Superieure de Lyon
  9. Date: Sat, 12 Dec 1992 12:52:34 GMT
  10. Lines: 93
  11.  
  12.  
  13. In article 724082271@limotoc, fxg@limotoc.informatik.rwth-aachen.de (Felix Gatzemeier) writes:
  14. > Hello
  15. > I am currently working on an assigment involving the graphics libarary of the
  16. > ISE complier, whose es tells me it's version 2.3, level 4. The problem is that
  17.  
  18. ....
  19.  
  20. > If I read ETL for 3.0 right, this would join the deferred features from
  21.  
  22. I think the core of the problem is that you are using Eiffel 2.3 which uses
  23. a different method than Eiffel 3.0 in some cases.
  24.  
  25.  
  26. > MY_GEN_FIGURE with the implementations from CIRCLE, so that a call to
  27. >     mc: MY_CIRCLE;
  28. >     ...
  29. >     mc.slide(shifter);
  30. > would call CIRCLE's erase, translate and display features.
  31. > Instead, I get a bunch of name clashes: more than one parent... errors.
  32. > I have tried several clutches:
  33.  
  34. In eiffel 2.3 when you are trying to join deferred features you have
  35. to declare it explicitly in the inherit clause with define for each
  36. deferred feature you join.
  37. For instance :
  38.  
  39.     class MY_CIRCLE
  40.  
  41.  
  42.     inherit
  43.      CIRCLE;
  44.      MY_GEN_FIGURE
  45.          define barycenter,contains,convert_to_resolution,display,
  46.              duplicate,erase,origin,recompute_closure,
  47.              rotate,scale,translate, fillable
  48.  
  49.     feature
  50.     
  51.     end
  52.  
  53.  
  54.     deferred class MY_GEN_FIGURE
  55.  
  56.     inherit
  57.         GEN_FIGURE
  58.             redefine fillable;
  59.  
  60.     feature
  61.  
  62.         slide (v: VECTOR; win: GRAPH_WINDOW) is
  63.             do
  64.                 erase (win);
  65.                 translate (v);
  66.                 display (win);
  67.             end;
  68.     
  69.         fillable : BOOLEAN is
  70.             deferred
  71.             end;
  72.     
  73.     
  74.     end
  75.  
  76.  
  77.  
  78. As all routines in the define clause of class MY_CIRCLE were effected
  79. in ELLIPSE or in some other ancestor, they can't be handled properly just by
  80. repeated inheritance. You have to use "definition".
  81.  
  82. The case of fillable is special. Strangely it is not deferred in GEN_FIGURE
  83. but instead it returns systematically False. So it is redefined in CLOSED_FIG
  84. to return True. Obviously you can't obtain only one feature from two different
  85. versions if you don't undefine one. In Eiffel 2.3 you can undefine a feature
  86. by redefining it with a deferred routine as it is made in MY_GEN_FIGURE
  87.  
  88.  
  89.  
  90. > I am nearly driven crazy by this. I know that there are less general solutions
  91. > to it, like having the world handling the movement in this special case, but
  92. > I want that general solution. After all, that's why I took up OOP in the first
  93. > place.
  94.  
  95. I think version 3.0 is in some cases far easier to use.
  96.  
  97. Loic PRYLLI
  98. ENS-Lyon
  99. France
  100.  
  101.  
  102.  
  103.  
  104.