Boost logo

Proto :

Subject: Re: [proto] Thoughts on traversing proto expressions and reusing grammar
From: Eric Niebler (eric_at_[hidden])
Date: 2010-10-21 20:53:36


On 10/21/2010 12:13 PM, Joel de Guzman wrote:
>
> Do you mean that it has to be exactly that to be called a "visitor"?
> How exact? Does it have to be "an OO hierarchy with a virtual "Dispatch"
> member that accepts a visitor"?

No, there's some wiggle room. I tried to state in a latter message what
I think the essence of the visitor design pattern is.

> Does the Boost Variant visitation scheme (for example) satisfy these
> conditions?

The essentials are there, yeah. There is an implicit hierarchy, the root
of which is, say, variant<A,B,C>. The subtypes are A, B and C. It's not
a classic OO hierarchy, but admittedly that's not essential. There is a
visitor. There are two dispatches: one on the "dynamic" type of the
variant, either A, B, or C. There is second dispatch based on the type
of the visitor. Pretty straightforward.

Can you do a similar analysis for Thomas' code? I tried and am not
certain about my results.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Proto list run by eric at boostpro.com