
On Tue, Feb 17, 2009 at 2:34 PM, Steven Watanabe <watanabesj@gmail.com> 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