Hi Doug: thank you for the update. So Demeter/Java already allows API definitions a la Persephone with the restrictions: 1. API methods may not have arguments. 2. no object transportation. 3. no shortest path semantics. We all agree that object transportation and shortest path semantics (as an option) are good ideas. Regarding 1, I was referring to the Persephone methods that have local variables which are used as arguments to the derived edges that have arguments. I would like to know how you judge that part of Persephone. Should that be added to Demeter/Java or do you have a better idea. -- Karl ================= From dougo@ccs.neu.edu Mon Oct 26 12:52:43 1998 To: Karl Lieberherr Cc: jayantha@ccs.neu.edu, johan@ccs.neu.edu, lorenz@ccs.neu.edu, mira@informatik.uni-siegen.de, dougo@ccs.neu.edu Subject: Re: derived edges/APIs Karl Lieberherr writes: > Can Demeter/Java handle traversals through derived edges? Yep. > Do you have an example somewhere? Well, the new version of the tg package (err, the AP Library) (which isn't checked in yet) has a derived edge to keep track of intercopy edges incident with a traversal graph vertex: TGVertex { (@ private int_int_Pair_List real_intercopyEdges = new int_int_Pair_List();; private int trav = 0; @) get intercopyEdges (@ if (trav != TraversalGraph.curTrav) set_intercopyEdges(new int_int_Pair_List()); return real_intercopyEdges; @) set intercopyEdges (@ real_intercopyEdges = dest; trav = TraversalGraph.curTrav; @) } Since the TraversalGraph object (which is a collection of TGVertex objects) is re-used for all the traversals, the intercopy edges get recalculated for each traversal. But the above trick lets me only calculate the intercopy edges for vertices that are in the strategy graph, rather than the entire class graph; if the intercopyEdges part hasn't been set for the current traversal (checked by looking at curTrav, which is a global counter that's incremented for each traversal computation) then just use an empty list. While I don't really do a traversal through this derived edge as part of the main functionality, for debugging I have a toAll(UniversalVisitor) traversal which does go through it, so i can (e.g.) print the intercopy edges for all the vertices. Hm, I thought there was another example in the suite-derived directory in the regression tests, but none of those tests actually traverse through a derived edge. I should probably add one or two. > What happens if a derived edge has arguments? Currently you can't define a derived edge with arguments. > Do you think the Persephone solution is a good one that should be > added to Demeter/Java? You mean object transportation? Sure. Also, the Persephone model of generating a single method with a chain of getters is similar to what we've been discussing as a good optimization (when possible, i.e. no cycles or alternation edges in the traversal graph). Actually, Johan might have already done this in his one-class-per-traversal hacking? --dougo@ccs.neu.edu