Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: Boost.String.Convert
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-02-17 17:43:16


On Tue, Feb 17, 2009 at 2:34 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> Emil Dotchevski wrote:
>>
>> 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.
>
> The only other benefit, is possible syntactic nicity. Note that
> this function can be in a very light weight header that forwards
> to the correct implementation, so the coupling would be minimal.

Your description is identical to 1) as far as I'm concerned because
there is no coupling between to_string and from_string (the coupling
is between convert() and to_string/from_string). However, in this
design it makes sense convert() to be a separate library altogether,
assuming it's scope goes beyond string conversions alone.

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