Visitors to the rescue? Hi Geoff: here is another idea which we could use: I refer to the class dictionary for graphs on page 213 and the program on page 214 of my book. (Note: I switched the arguments for the find method to make it traversal ready.) Let's assume that we want All Adjacency-objects of the outgoing edges from some Adjacency-object. We would like to write one strategy: from Adjacency through -> *,neighbors,* to Adjacency A traversal might be: Adjacency Vertex_List Vertex_NonEmpty Vertex Adjacency ^ derived egde: find The last edge is a derived edge: -> Vertex,find,Adjacency wich requires Graph g as argument. (It needs to search through the list) This traversal can only be used with a visitor which has g as an instance variable. In this view strategies have a precondition: they can only be used with visitors containing parts with the right names and types. When a derived edge is traversed which requires some arguments, they are taken from the visitors. Visitors have the purpose of carrying objects across other objects besides doing the work in addition to the traversals. Does this solution look better? -- Karl ====================================== From ghulten@ccs.neu.edu Tue Aug 5 10:57:03 1997 To: "Karl Lieberherr" cc: Professor, I've been thinking about multiple arguments for derived edges. I thought that by not allowing any arguments things would be simpler. Now I see that I was wrong. As you say, people can simply deposit arguments on the source class to make them visible to the derived edge calculation code (the derived edge's over method). This seems horrible. It's not clear at the design level, and is tricky to implement at a code level. That said, I'm having a hard time thinking of a better way we could do it. The problem I see is that, every time a traversal wants to cross a derived edge, it has to go collect the objects needed as arguments for the derived edge's over method. So every time a traversal wants to cross a derived edge it needs to go do some work to track down arguments? Does this mean we won't be able to say 'to *;' about class dictionaries containing such derived edges? It also seems that every time a programmer adds a derived edge that takes arguments to a class dictionary, they would need to check every existing traversal in their program to determine which traversals cross this new derived edge. Those traversals will need to be modified to take deliver the appropriate arguments. what am I missing? -Geoff