Boost logo

Proto :

Subject: Re: [proto] Thoughts on traversing proto expressions and reusing grammar
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2010-10-21 02:41:07


On Thu, Oct 21, 2010 at 7:50 AM, Thomas Heller
<thom.heller_at_[hidden]> wrote:
> On Thursday 21 October 2010 05:11:49 Eric Niebler wrote:
>> On 10/20/2010 7:49 AM, Thomas Heller wrote:
<snip>
>> > Here it goes:
>> >     namespace detail
>> >     {
>> >
>> >         template <
>> >
>> >             typename Grammar, typename Visitor, typename IsRule = void>
>> >
>> >         struct algorithm_case
>> >
>> >             : Grammar
>> >
>> >         {};
>>
>> Why inherit from Grammar here instead of:
>>   : proto::when<
>>
>>         Grammar
>>       , typename Visitor::template visit<Grammar>
>>
>>
>> ?
>
> Because I wanted to have an "escape" point. There might be some valid
> usecase, that does not want to dispatch to the Visitor/Actions. This is btw
> the reason i didn't reuse or_, but introduced the rules template. To
> distinguish between: 1) "regular" proto grammars --> no dispatch 2) the
> rules, which do the dispatch.

Ok ... after rereading your mini phoenix you solve that problem with
default_actions.
Very neat as well!


Proto list run by eric at boostpro.com