Re: New compose and format API



The compose and format API saves C++ from gettext a lot. And it reminds me a similar library of boost::format [1], which basically does the same thing, but provides different interfaces. I'm not an expert, but I believe the Boost one might be better than yours in the following 2 aspects:

1. format-string specification

boost::format retains the old printf format (%spec), and provides more flexible syntax, such as %|spec| which can omit the type-conversion character, as well as %N% which plays as place holder, while you were using %N as place holder. The lack of printf-like format might results in incompatible interfaces with plain printf and might compromises the interoperability of format string with other printf-like functions. Though they are definitely not good choices, they are still widely used. However, you can implement the same thing of course :)

2. operater%

Boost uses operator% to concatenate different part, which is generally type safer than variadic function calls, and might provides more flexibility in implementation before C++ allows overloading operator,.

Moreover - I think its less important - that boost::format has already been used for a while. Providing a similar syntax will of course increase the interoperability with many existing code using boost::format as well.

Again, I'm not an expert, and I've no rights to judge anything, and your library has been written out for quite some time already. But I wish you may consider my proposal, and thanks for your effort :)

[1] http://www.boost.org/libs/format/index.html




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]