Boost logo

Proto :

Subject: Re: [proto] : How to use complex grammars in a domain/extension
From: Eric Niebler (eric_at_[hidden])
Date: 2010-09-22 09:40:37


On 9/22/2010 1:22 AM, Thomas Heller wrote:
> Let me add something:
>
> The more I thought i about the problem, the more i thought that this would
> be a perfect use case for sub domains! So i tried to hack something
> together:

Interesting thought.

<snip>
>
> This seems to be exactly what Roland wanted to achieve in the first place.
> However, it looks like this design just overcomplicates stuff because we
> have to specify the "addition" in our base domain anyway ...

Yeah, it's rather complicated. Especially considering that lone
terminals really are valid in the super-domain, so the grammar of the
super-domain should simply reflect that.

> Initially i was under the impression that this wasn't needed, but it seems
> that proto cannot deduce something like:
>
> lhs_expression OP rhs_expression results in expression
>
> So the question is: is it reasonable to add features like that?
> It seems valuable to me.

Right, there's potentially a problem in Proto here. If RHS and LHS are
in different domains, a common super-domain is deduced first, and then
Proto checks to see if the LHS and RHS conform to that common domain.
That doesn't seem right. Can you open a ticket?

> If I omit the addition in the my_domain grammar, I could have defined the
> operator== myself. However I think that somehow defeats the purpose of
> proto, doesn't it?

Yes, you shouldn't have to define your own operators. It's tricky business.

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

Proto list run by eric at boostpro.com