Hi Doug: thanks for the reminder; >From dougo@ccs.neu.edu Sat Jun 7 00:28:51 1997 >From: Doug Orleans >To: lieber@carbon.ccs.neu.edu >Subject: wrapper inheritance > >Did you have any opinion about this? > >------- start of forwarded message ------- >From: Doug Orleans >To: lieber@carbon.ccs.neu.edu >cc: ghulten@carbon.ccs.neu.edu, kedar@carbon.ccs.neu.edu, > binoy@carbon.ccs.neu.edu, lth@carbon.ccs.neu.edu, > johan@carbon.ccs.neu.edu, fox@carbon.ccs.neu.edu, > dougo@carbon.ccs.neu.edu >Subject: wrapper inheritance >Date: Fri, 25 Apr 1997 00:35:18 -0400 >X-Face: (4D-osoq?}7M3\EgvbWKo tsxTzT"g.oP0dTl!q > >What should be the behavior in the following case? > > foo.cd: > Foo = . > Abs : Conc. > Conc = . > > foo.beh: > Abs { before Foo (@ System.out.println("abs"); @) } > Conc { before Foo (@ System.out.println("conc"); @) } > Foo { > traversal t(Abs v) { to Foo; } > (@ > public static void main(String args[]) { > new Foo().t(new Conc()); > } > @) > } > >Currently, it simply prints "conc", i.e. overriding behavior. In >order to have the Abs wrapper be called, you have to do this: > > Conc { before Foo (@ super.before(host); System.out.println("conc"); @) } > >However, this makes some assumptions about how wrappers are translated >to ordinary Java methods, which shouldn't be exposed. (The >translation is less straightforward when it involves edge wrappers, >especially around methods, and in any case may change in future >versions.) > >I see two alternatives: > > 1. Use incremental inheritance. But in which order should the > methods be called? And what if the user wants the opposite to > whatever we choose? We went through those decisions as part of the design of propagation patterns. Cun, Nacho and I were for incremental inheritance of wrappers and later Linda and Walter proposed overriding inheritance. We used overriding inheritance for a while in Demeter/C++. It did not work well; Cun then implemented incremental inheritance which worked very well. Linda and Walter discuss their point of view in their Ph.D. theses. My point of view is discussed in my book on AP, chapter 9, sections 9.1, 9.3 (especially 9.3.10). Here is my current view (see the Meal example, page 260 of my book on AP): Suppose you have a meal class graph and you want to compute the cost of a meal: With incremental inheritance it is easy to define the costs inrementally as shown on page 260. Such simple problems should have simple solutions and incremental inheritance provides this. Now, you bring up the question of ordering. I think we should use prefix-super-sub and suffix-sub-super (page 258). If someone needs another order, they program that in Java directly (using verbatim methods in Demeter/Java). > > 2. Provide some sort of syntax for resending the message to the > parent, e.g. "super.wrapper()". Then the user can arrange > things in whatever order he pleases. Unfortunately this would > probably require a lot of machinery behind the scenes. > >How does this generalize to context objects? That makes my head spin... > >--Doug > -- Karl >------- end of forwarded message ------- >