Passing arguments in Visitor Pattern
Does anybody have a nice solution to passing arguments in Visitor pattern?
The Visitor pattern is used to process an object structure (such as an abstract syntax tree) in many different ways without cluttering definitions of the objects with methods needed for all different kinds of processing. Instead, each object has only one method, "void accept(Visitor v)". The method calls back a method in the Visitor that is appropriate for the object. Different kinds of processing use different Visitors, each with its own set of object-processing methods.
My problem is that I need to pass arguments or receive results from the object-processing methods, different for different kinds of processing.
One solution is to have many "accept" methods with different signatures. This beats the idea that we do not need to modify definitions of the objects if we want to introduce new kind of processing.
Another is to provide "accept" with an Object result and a sufficient number of Object arguments, to be used as necessary by different Visitors. It results in clumsy and unreadable code. Detestable.
Alternatively, one could provide fields in the objects to pass the information when needed. This frees the invocations of "accept" from dummy arguments/results, but does not seem nice.
One can also forget all about Visitor pattern, and let the processing method test the object class using "instanceof" and call the right method. But this is a pure blasphemy against everything called OO.
Is there any better way that I am too blind to see?

