John Levon wrote:

>On Fri, Dec 14, 2001 at 02:07:05PM +1100, Ben Stanley wrote:
>
>>John Leveon asked me  how you would specify that one kind of inset is 
>>searchable but not spell-checkable, and that another kind of inset is 
>>spell-checkable and not searchable. Here is a complete self-contained 
>>example.
>>
>
>OK, I get it now, the method lookup does the type inspection via the parameter type
>matching. 
>
Uh, by the function name, but could name them all the same and do it by 
parameter type. The type lookup is really by the virtual Accept function 
in all the insets.

>That was the crucial point I was missing :)
>
>And I like it, I think. Not sure about the other example though ...
>
Oh, didn't you like it? The contents of the visitor's methods would be 
pretty much the same as the current WriteAsText (or equivalent) methods 
dotted all over the Inset code... It just collects it all into one 
place. And where the WriteAsText method would call a sub-inset's 
WriteAsText method to get it to write itself out, the Visitor's method 
would call
inset.Accept(*this);
to do the same thing and correctly virtually dispatch it.

Then all the WriteAsText code is collected into one file, all together, 
easier to maintain and make sure it's all consistent.

Ben.



Reply via email to