This is a request coming from a discussion between Systerel and the University of Düsseldorf held this afternoon: The idea is to have the AST library providing a simpler visitor design pattern where the accept method does not implement the traversal of the tree internally, but rather delegate it to the visit method. This allows for visitor specific traversals of a tree.
A tentative profile for the visit method is:
<R, P> R visit(Alpha node, P param)
where "node" is the node visited, "Alpha" is its class(a subclass of Formula) and "param" is a client-specific parameter.
Logged In: YES
user_id=1540408
Originator: NO
I propose, for the visitor, a generic interface
For example :
public interface ISimpleVisitor<R, P> {
R visitBecomesEqualTo(BecomesEqualTo s, P p);
...
}
And for the accept method (for the class BecomesSuchThat):
public <R, P> R accept(ISimpleVisitor<R,P> visitor, P p) {
return visitor.visitBecomesSuchThat(this, p);
}
Logged In: YES
user_id=2102738
Originator: NO
Implemented. Provided interface ISimpleVisitor.