Boost logo

Proto :

Subject: Re: [proto] Recent (rvalue support) changes in proto causes a whole bunch of regressions in Spirit
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-10-10 01:52:28


On 10/10/2011 12:38 PM, Eric Niebler wrote:
> On 10/9/2011 8:32 PM, Joel de Guzman wrote:
>> Hi,
>>
>> This code:
>>
>> #include <boost/spirit/include/qi.hpp>
>>
>> int main()
>> {
>> namespace qi = boost::spirit::qi;
>>
>> qi::rule<char const*> r;
>> r %= (+qi::char_);
>>
>> return 0;
>> }
>>
>> no longer works as expected. r %= (+qi::char_) becomes a no-op.
>> Before it calls either:
>>
>> template <typename Expr>
>> friend rule& operator%=(rule& r, Expr const& expr);
>>
>> // non-const version needed to suppress proto's %= kicking in
>> template <typename Expr>
>> friend rule& operator%=(rule& r, Expr& expr);
>>
>> Both defined in the rule class.
>>
>> Correct me if I'm wrong, but it seems the changes in proto forces
>> us to support rvalue refs, but we are not ready for that yet and
>> it's too late in the release cycle.
>>
>> Thoughts?
>
> Bummer. I suggest adding an rvalue ref overload of operator%= that
> shares an implementation with the const lvalue one. Should just be a few
> lines of code. Is that a problem?

Not really a problem. But, %= is just an example of the problems
(plural with an s). We suspect that it is more widespread. I'll
see how pervasive the changes need to be and get back to you.

> As an alternative, you can use a domain/grammar to disable Proto's
> operator%= for Spirit rules.

As I said, I'm hesitant to do more changes this late in the
release cycle.

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://boost-spirit.com

Proto list run by eric at boostpro.com