RE: [boost] Formal review of "Output Formatters" library begins today

Paul A Bristow wrote:
| [mailto:boost-bounces@lists.boost.org] On Behalf Of Reece Dunn | > "Boost prefers clarity to curtness". | | I have been giving this some thought. What I am looking at at | the moment is | something like: | | std::pair | < | std::pair< int, std::vector< char > >, | std::list< boost::math::quaternion< float > > | > mct;
Which leaves me puzzling what on earth mct can be short for ! myVeryContrivedContainerType?
Is this a complex demo assemblage?
Yes. It was to give an example of the new (planned) naming scheme to output mct [my_complex_type].
| namespace io = boost::io; | namespace fmt = boost::io::format;
using boost::io::format;
would allow you to replace fmt with format? Which is much easier to understand, especially for those for whom english is not their first language?
I would prefer to use a namespace alias where possible as I dislike unnecessarily polluting the global namespace. As to namespace format = boost::io::format; vs namespace fmt = boost::io::format; you can see that these are aliases for "boost::io::format", just like namespace fs = boost::filesystem; As long as it is put at the top of the code examples/tests and put in the documentation introdution at the beginning, clearly stating that "fmt" is a namespace alias for "boost::io::format" I don't see it being a problem. The problem with the current implementation naming scheme is that it uses Xfmt consistently and most importantly, *the user has no control over this*. Feel free in your code to use: namespace format = boost::io::format; or equivalent. Is there a concensus for/against the use of the shorter fmt::basic(), etc. in the docs and code? Dave? John?
Have I commented this correctly (and informatively)?
Yes. Although I am not sure of the behaviour of using on a namespace name (don't you need a using namespace or a namespace alias?)
| std::cout << io::object( mct, | fmt::pair | ( | fmt::pair( fmt::basic(), fmt::container()), // basic used for int, container is a vector. | fmt::container( fmt::nary()) // container is list, and n in the nary is 4 for a quaternion. | ) | );
| With io::delimiter holding one of the delimiter values. | io::wrapped_delimiter will replace io::openclose_formatter in holding open/close delimiter pairs
why wrappED? io::wrapper? ({} [] ...
The io::wrapped_delimiter above is a holder for open and closing pairs, so io::wrapper_delimiter doesn't seem syntactically correct. Maybe io::wrapp*ing*_delimiters?
| and io::sequence_delimiter replaces io::formatter.
io::separator? , | ...
Maybe io::sequence_delimiters. This is because it contains open/close *and* separator delimiters, since it is controlling how a sequence type is rendered.
(Of course, if English spelling made any sense whatever, it would be separater - but it hasn't got to be the premier language by being phonetic, consistent and logical, has it?)
Causing me a great deal of confusion (even being a native English speaker!)
Paul
PS /rubbing_it_in_mode on
some filenames have the spelling mistake too ;-) This may confuse some using search later.
Doh!
/rubbing_it_in_mode off and finally
std::cout << boost::io::formatob( vec ).format( "{ ", " }" ); <<<<<<<<<<< isn't this missing a ':' separator??? // output: { 1 : 2 : 3 }
Thorsten spotted this as well. I have updated the docs to: // output: { 1, 2, 3 } Thanks, Reece _________________________________________________________________ Stay in touch with absent friends - get MSN Messenger http://www.msn.co.uk/messenger

The problem with the current implementation naming scheme is that it uses Xfmt consistently and most importantly, *the user has no control over this*. Feel free in your code to use: namespace format = boost::io::format; or equivalent. Is there a concensus for/against the use of the shorter fmt::basic(), etc. in the docs and code? Dave? John?
I'd certainly like it, at least in the docs. Best, John -- John Torjo -- john@torjo.com Contributing editor, C/C++ Users Journal -- "Win32 GUI Generics" -- generics & GUI do mix, after all -- http://www.torjo.com/win32gui/ -- v1.4.0 - save_dlg - true binding of your data to UI controls! + easily add validation rules (win32gui/examples/smart_dlg)
participants (2)
-
John Torjo
-
Reece Dunn