-
Notifications
You must be signed in to change notification settings - Fork 3
About Format
C++ formatting has moved away from format strings of C to formatting code. This is in my opinion a step in the wrong direction and type safety is not enough of a reason for that. Actually C format string should have been expanded to allow out-of-order or named parameters and extensibility.
Of course safety is important, but formatting in code is a price too high to pay for that. Moreover it's in my opinion possible to keep a library "reasonably" safe for example guarding from malign format strings (necessary if they're read from external sources) without however enforcing compile-time type determination for all formatting decisions, an approach that by definition rules out dynamic format strings (a very important use case) and that in current C++ makes writing code generating formatted output a pain.
This project is about getting back dynamics in formatting for C++. boost.format is a small step in the right direction but still too type-obsessed and too small (only deals with reordering, formatting options are still in the code instead than in format strings).
- Would allow specifying more parameters for data->string conversion covering most common cases.
- Would specify formatting options should be specified in the string, not in the data passed to formatting or (even worse) in the stream. It could make sense however to have some global (or even better "environmental") settings.
- Should allow or even force for named substitution instead of fixed positional substitution.
- Should cover formatting to string by default (it's way easier to output a string than to redirect output to a string; also formatting to a string is a very common use case in real software, possibly more frequent than formatting to an output stream).
- Should handle common conversions (e.g. unix timestamp -> human readable date).
- Should allow for formatting of user defined types, also facilitating formatting composition.
- Should allow for formatting of generic sequences or containers (partial specialization).