|
Boost : |
Subject: Re: [boost] Formal Review Request: Boost.String.Convert
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-02-17 17:00:30
On Tue, Feb 17, 2009 at 12:26 PM, Andrey Semashev
<andrey.semashev_at_[hidden]> wrote:
>> You can convert different things to string using to_string. You can
>> convert different things from strings using from_string.
>>
>> My question is, what is the motivation for the convert function?
>> What's the use case for it that doesn't work with
>> to_string/from_string?
>
> There isn't any particular case for using the "convert" naming. As there
> isn't one for "to_string/from_string".
The issue is not just naming and syntax.
The two approaches are:
1) Define a "to_string" interface and a separate, independent
"from_string" interface
2) Define a single interface that can go to and from string
The second approach introduces coupling between to_string and
from_string. This coupling must be justified, you need to get
something in return. The only "something" I see here is that it lets
you write code which doesn't "know" if it's going "to" or "from"
string.
My problem is that I can't think of a case when I would be writing
code that doesn't "know" if it is going "to" or "from" string. Can
you?
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk