Boost logo

Boost :

Subject: Re: [boost] [convert] no-throw and fallback feature
From: Matthew Chambers (matt.chambers42_at_[hidden])
Date: 2011-05-09 16:15:43


On 5/9/2011 2:58 PM, Stewart, Robert wrote:
> Vicente BOTET wrote:
>> De : "Stewart, Robert"
>>
>>> You don't think "convert" is a good choice?
>>
>> I would prefer to use a noun for namespace, then an adjetive
>> and in the last instance a meaningless name, like spirit. I
>> have never used a verb as namespace.
>
> That's a good policy. My only argument in favor of "convert" is that it works so well for things like convert::to (and it's shorter!).

>> The same applies to classes. For me convert stands for a
>> function, converter for a class, convertible for an interface
>> and conversion for a namespace. I'm sure you agree with me on
>> this common usage.
>
> Yes, certainly.

If there will be short names like "to" or "as" in the namespace then namespace qualification in user
code will practically be necessary. So 'convert' would look much better in that case. But I'm not a
fan of the short names and would rather do:
namespace bcv = boost::conversion;
bcv::convert_to<int>("42");

On the other hand, 'convert' is both a noun and a verb. :P

>> The name. boost::convert_to_or() or
>> boost::conversion::convert_to_or() are good for me.
>
> Well, I'll just reiterate that convert_to_or<int>(s, i) reads wrong to me. I see the possibility that "to" goes with "<int>" and "or" with "i," but that's just too unusual.

I agree with Rob; the word "or" is a bad way to end an identifier.

-Matt


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