Subject: Re: [boost] Formal Review Request: Boost.String.Convert
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-02-17 14:33:33
On Tue, Feb 17, 2009 at 14:19, Andrey Semashev
> Emil Dotchevski wrote:
>> I like the idea of a library for converting to and from strings.
>> I have two comments:
>> 1) I don't like the string namespace. I would prefer to use
>> boost::to_string and boost::from_string:
>> std::string s=boost::to_string(x)
>> reads better than
>> std::string s=boost::string::to(x).
> We had a hot discussion on the naming issue just recently.
> The outcome was that to_string/from_string are not verbs, are slightly
> longer than convert and duplicate the namespace name; to/from are
> meaningless without the surrounding namespace name, which may be omitted or
> mangled with aliases.
Is that really the outcome? The from and to functions are still
there, and still confusing.
I'm much prefer to_string, especially since string::to is the opposite
meaning of what std::bitset and every java programmer expect from "to"
in the context of strings.
I'm still not sure why we're stuck with such a lexical-cast-like
interface anyways. Every single example is always used to assign to a
variable, and since the functions have to be returning proxies anyways
(since it's apparently possible to add manipulators) you often can't
pass directly to functions because of template argument deduction
Using an output parameter would free up the return value for success,
which may well be more natural. It also trivially avoids the default
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk