|
Proto : |
Subject: Re: [proto] Thoughts on traversing proto expressions and reusing grammar
From: Joel de Guzman (joel_at_[hidden])
Date: 2010-10-21 15:13:58
On 10/21/10 11:11 AM, Eric Niebler wrote:
> On 10/20/2010 7:49 AM, Thomas Heller wrote:
>> I worked a little on trying to simplify that whole grammar with
>> rules that have thing a bit. Forgive me, but i changed the name to Visitor.
>> Why? Simply because i think this is what is done here. We visit a specific
>> node which happened to match our rule.
>
> Most tree traversal algorithms "visit" each node, but the term "Visitor"
> means something very, very specific: the Gang-of-Four Visitor Design
> Pattern. It implies an OO hierarchy, a virtual "Dispatch" member that
> accepts a visitor, and a 2nd dispatch to an "Accept" member of the
> visitor object. It is used to "add" members to an OO hierarchy post-hoc
> by putting them in a visitor instead of having to change every type in
> your hierarchy.
>
> If you don't have something like that, then don't call it Visitor. If
> you do, then we need to reformulate this design to make that pattern
> more explicit. Otherwise, it will cause no end of confusion.
>
> Historical note: I originally called the "data" parameter of Proto
> transforms "visitors". During the review, there was such a hue and cry
> (for good reason) that I had to change it. True story.
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"?
Does the Boost Variant visitation scheme (for example) satisfy these
conditions?
Regards,
-- Joel de Guzman http://www.boostpro.com http://spirit.sf.net
Proto list run by eric at boostpro.com