> > i dont really understand why u need the ACP being so different to > > plain > > visitor; i mean cant they share some skeleton part of traversing, > > while > > putting all the choices (visit* vs convert; onentry/onexit; > > stop/dont) in their own parts. > > After all, visitor pattern is twofold, a) Guide + b) Visitor; > > the Guide > > doing traversing, the Visitor noting things; choice where to go > > might be > > in visitor and/or in guide. some times (one extreme) the visitor > > is just > > one dumb functor; other cases (other extreme end) the visitor is > > very sofisticated and even does guiding/traversing. > > Here it looks more like second case, u have most of both sides > > put in the Visitor, and only small part (specific visit_* / > > copy_internals) left to the actual nodes. > > And to me, the skeleton is still same between ACP and > > ClauseVisitor. > > you cant use plain visitor beacuse you are copying the whole > structure in place at the same time, and a method is deciding > arbitrarily to not copy certain elements, and instead returns an > element that was set from the outside; that element cannot be > mutated since its not from the original structure, therefore it > cannot be traversed. well this is a behavior that can be controlled - to traverse the originals that are to be replaced, or not; and to traverse the replacement AFTER it has been replaced or not.
> as it turns out, this visitor still has lots of problems which will > continue to prevent more sophisticated copy-and-replace > operations...some of the ways that a Select() just works from the > ground up just get in the way here. mmmh. u can think of splitting the Visitor into 3: Guide (who traverses _everything_ given), Visitor (who does things), and intermediate Decisor, who decides where to go / what to do. But this can get complicated (slow) although it would be quite clear who does what. Also, do have both onEntry and onExit for each node; i am sure some operations will require both; first to gather info, second to make a decision about what to do with it while still at that level. i've done quite a lot of tree/expression traversers, and while readonly walking doesnot care much if on entry or on exit (except if u want depth or breadth first), replacements-in-place and copy+replace sometimes needed both entry and exit hooks, + they where conditional like in leafs. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
