Hi Doug and Lars and Johan: >From dougo@ccs.neu.edu Fri Oct 10 09:25:13 1997 >From: Doug Orleans >To: Karl Lieberherr >Cc: dem@ccs.neu.edu, ldodds@ccs.neu.edu >Subject: Re: one visitor adaptive methods > >Slowly catching up with old discussions... > >Karl Lieberherr writes: > > Since Demeter/Java allows now to declare classes explicitly as visitor > > classes, we could adopt the following rule: > > > > void f() to X (V); > > > > is equivalent to > > > > void f(x) to X (V,V1,V2, ... ,Vk) > > > > where V1 through Vk are all the visitor > > classes reachable in depth-first order from V (in the class graph). > > > > V could be a deeply nested visitor class. The only tricky issue is that > > we have to order the part classes of V so that the depth-first order > > will give the correct visitor ordering. > >As others have said, it seems a little too arbitrary to search the >visitor object for parts which happen to be visitors. Maybe what is I agree with you. Lars was expressing that most forcefully. >needed is a new kind of edge in the class graph, "controls" (or >"subvisitor"?), which specifies which visitors control which other >visitors. E.g. visitor class V controls visitor classes V1 and V2, >which means that whenever V visits an object, both V1 and V2 (in >order) also visit the object. That is a good idea: express the subvisitor relation with a new kind of relation instead of using part-of relations. It appears that we would like to express little clusters of such relationships to be used for different tasks. > >Hm, now that I think about it, this is almost looking like >multiple inheritance: if V were a subclass of V1 and V2, then it would >combine the behavior of both (as well as its own additions and >overrides). Could the examples you have with multiple visitors be >rewritten to use multiple inheritance? Unfortunately to implement >this in Java we'd need explicit delegation to simulate multiple >inheritance-- but hey, we're generating code anyway, why not do that >too? > >--Doug > > >