December 30th, 2015, 11:08 am
QuoteOriginally posted by: CuchulainnI don't use OOP patterns so much anymore but we used them with much success in CAD, graphics and optical technology (holography) in several production systems. There is probably no compelling reasons to use it. Besides, you choose between Boost static_visitor and GOF Visitor.We need it dynamic, using static_visitor dynamically requires some tricks including preprocessor stuff making it all more convoluted than a dynamic visitor, and GOF is brittle and insufficient.QuoteThings have moved on; in FP languages Visitor is a fold and it's free. Almost spot on ;-)QuoteQuoteCooperative Visitor technique provides the flexibility of Acyclic visitor with performance that approaches the Cyclic visitor. Cooperative Visitor provides advantages over standard visitor implementations by allowing configuration: the name of visit methods, the return type, the const-ness, the number of arguments. The ease of use approaches that of other Visitor implementations and libraries. The technique is standard C++ and is portable. This is fine, but do we want so much flexibility? More is less?In this case it's basic language features missing not bells&whistles, so yes, I need it all, but without the hassle of cooperative visitor possibly. Requirements already dictate flexibility so that's not a choice, but currently we do it in a convoluted fashion, a big ball of mud is growing, and I want that cleaned out. And ideally I'd like static and dynamic dispatch with a common interface as with virtual functions. Anyway acyclic visitor has too much overhead for restricted functionality, there's space for some arbitrage here...We have various use cases, but of course the classical one are actions on heterogeneous object hierarchies... which gets particularly interesting when objects are algos and things get reflexive (that's why we couldn't use virtual funcs even if we had the patience), but that's another story.Actually they're currently discussing a visitor in the c++std list, but the major guys somehow aren't participating and the current state seems pretty lame.