Boost logo

Proto :

Subject: Re: [proto] Recursive functions in a mini language
From: Eric Niebler (eric_at_[hidden])
Date: 2010-08-09 16:20:01

(Sorry for the delay. It was a crazy weekend.)

On 8/6/2010 8:21 PM, Manjunath Kudlur wrote:
> Eric Niebler wrote:
>> Let me understand. Your goal is to have something like spirit subrules,
>> except the subrules are like ordinary functions, and the functions
>> should be invokable by name, is that right? Spirit subrules are neat and
>> tidy and efficient because they are hidden away inside a grammar. But
>> that's not your case. Hence the need for the module and the operator->*.
>> Did I get that right?
> Yes. I know with Spirit subrules, one only exposes the top level rule
> and the auxiliary rules are hidden inside the grammar.


> Here, my goal
> is to provide the user with a mechanism to define a set of mutually
> recursive functions, and he should be able to "call" any of the
> functions. He has to do module->*func(...) and cannot do just
> func(...) because the definitions of functions are contained in the
> module.

Actually, I think your users will be forced to do: (module->*func)(...)
because of the precedence. That's pretty ugly. But I see where you're
going. Your scheme could be made to work as you describe, I think.

I'm left wondering why you want this, though. In what way is it better
than just defining some mutually recursive functions?

Eric Niebler
BoostPro Computing

Proto list run by eric at