Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Type Traits Extension by Frederic Bron
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-03-16 08:11:51


Frédéric Bron wrote:
>
> >> There would seem to me to be a very strong case for having
> >> the same names as in Boost.Proto and Boost.Operator.
>
> It would be difficult to have the same names as in Boost.Proto
> and Boost.Operator as they are different. However Boost.Proto
> seems to be the good candidates as it addresses all operators
> which is not the case for Boost.Operator. Also many names are
> already the same (see below).

+1

> type_traits Boost.Proto Boost.Operators binary
>
> == equal_to equal_to equality_comparable
> != not_equal_to not_equal_to
> < less less less_than_comparable
> <= less_equal less_equal
> > greater greater
> >= greater_equal greater_equal
> + plus plus
> - minus minus
> * multiplies multiplies
> / divides divides
> % modulus modulus
> += plus_equal plus_assign addable

Notice that "==" is about equality comparisons, so "equal" has to do with the operation rather than the symbol. Here, the operation is assignment (after addition), so "assign" is quite appropriate.

By contrast, "plus" is about the symbol more than the operation. Thus, Proto's name is internally inconsistent. "add_assign" would be better.

> -= minus_equal minus_assign substractable

Ditto for "minus" versus "subtract."

> *= multiplies_equal multiplies_assign multipliable

I would prefer "multiply" to "multiplies," but it may be better to favor consistency with Proto.

> /= divides_equal divides_assign dividable

Ditto for "divide" versus "divides."

> %= modulus_equal modulus_assign modable
> & bit_and bitwise_and
> | bit_or bitwise_or
> ^ bit_xor bitwise_xor
> &= bit_and_equal bitwise_and_assign andable
> |= bit_or_equal bitwise_or_assign orable
> ^= bit_xor_equal bitwise_xor_assign xorable

FWIW, I always use "bitwise" rather than "bit" when I verbalize those operators.

> << left_shift shift_left
> >> right_shift shift_right
> <<= left_shift_equal shift_left_assign left_shiftable
> >>= right_shift_equal shift_right_assign right_shiftable

I find direction + "shift" the better order, but consistency with Proto might be the better thing.

> && logical_and logical_and
> || logical_or logical_or prefix
> + unary_plus unary_plus
> - unary_minus negate

An odd inconsistency in Proto, unless "negate" was actually from Operators.

> ~ complement complement
> ! logical_not logical_not
> * dereference dereference
> ++ prefix_increment pre_inc incrementable
> -- prefix_decrement pre_dec decrementable postfix
> ++ postfix_increment post_inc
> -- postfix_decrement post_dec

I generally like the names from Proto. Consistency would be nice, but consider the names as they are likely to be standardized. Better to get the names "right" now. For example, I think "postfix_increment" is a likely name for standardization, while "post_inc" is not.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk