[proto] new version, breaking changes (was: proto::tag naming convention)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[proto] new version, breaking changes (was: proto::tag naming convention)

Eric Niebler

Eric Niebler wrote:
> Maurizio Vitale wrote:
>> What is the rationale for not having proto::tags match the corresponding
>> mpl metafunctions?
>>
>> For instance mpl has plus and proto has add (but unary_plus).
>
> Oh my. You're right, that's awful. I'll fix these.

I've changed the names of some types in proto to bring it in line with
conventions established in <functional> and Boost.MPL. This should
affect just about everybody currently using proto. In particular:

proto::multiply           ->   proto::multiplies
proto::divide             ->   proto::divides
proto::add                ->   proto::plus
proto::subtract           ->   proto::minus
proto::equal              ->   proto::equal_to
proto::not_equal          ->   proto::not_equal_to
proto::unary_plus         ->   proto::posit
proto::unary_minus        ->   proto::negate
proto::unary_star         ->   proto::dereference
proto::multiply_assign    ->   proto::multiplies_assign
proto::divide_assign      ->   proto::divides_assign
proto::add_assign         ->   proto::plus_assign
proto::subtract_assign    ->   proto::minus_assign

The corresponding tag types have also changed accordingly. For the
complete list of tags, see:
<http://boost.cvs.sourceforge.net/boost/boost/boost/xpressive/proto/tags.hpp?view=markup>

The docs, tests and examples have been updated to reflect the new names.
Get the latest from CVS, or from proto.zip in the Vault.

--
Eric Niebler
Boost Consulting
www.boost-consulting.com

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Spirit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-devel
Reply | Threaded
Open this post in threaded view
|

Re: [proto] new version, breaking changes

Eric Niebler
Steven Watanabe wrote:

> AMDG
>
> Eric Niebler <eric <at> boost-consulting.com> writes:
>
>>> If you want to change both, a possibility would when (for if_) and  
>>> unless (for not_).
>> Interesting. All, any, when, and unless are not unreasonable. I know you
>> retracted this suggestion in another message, but I want you to bring it
>> up again when proto is under review. Naming is super-important, and I
>> want more feedback on this issue. I'll remind you when the time comes.
>>
>
> Another possibility is to use separate namespaces
> proto::operators::or_
> proto::control::or_

I thought about that, and it's not unreasonable, either. It might cause
less confusion. However, the different or_'s will often be used
together, making qualification a requirement. Compare the following
(assumes using namespace proto;):

   struct MyGrammar
     : control::or_<
           operators::or_<_,_>
         , operators::bitor_<_,_>
       >
   {};

to

   struct MyGrammar
     : or_<
           logical_or<_,_>
         , bitwise_or<_,_>
       >
   {};

IMO, eliminating the operators:: namespace would be better. This isn't
half bad:

   struct MyGrammar
     : control::or_<
           or_<_,_>
         , bitor_<_,_>
       >
   {};

But control::or_ is likely to be more common than or_ (the operator), so
the Huffman coding is lousy. Gah, naming is hard! Opinions? Maurizio?
Joel? Hartmut?

--
Eric Niebler
Boost Consulting
www.boost-consulting.com

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Spirit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-devel