
On 03/16/2010 02:35 PM, Stewart, Robert wrote:
Andrey Semashev wrote:
On 03/15/2010 09:10 PM, Vladimir Prus wrote:
On Monday 15 March 2010 20:24:49 Andrey Semashev wrote:
* Why can't I use the library without named parameters? Surely, there are low-tech ways to specify things.
What are these?
The simplest would be:
file_log_parameters p; p.filter = ... ; p.formatter = ... ; init_log_to_file(p);
This is straightward for any user, produces clear error messages, and is not much of a inconvenience.
The filter is the property of the log frontend, and formatter is the property of the backend. Using named parameters allows to direct the appropriate parameters to their particular receivers. Also, it's more efficient than filling the structure.
Whether Boost.Parameters is the best solution, or as good as any other, for your purpose, don't forget the overhead of compilation time and errors. Template code is, of course, problematic when things go wrong. Parsing the compiler output is often difficult. A simpler, more straightforward solution, along the lines proposed by Vladimir, makes for simpler, more straightforward error messages, and can dramatically reduce compilation time.
It's another layer of scaffolding, that I, Vladimir and others so dislike. Boost.Parameter allows to cut down the interface to the essence and also enables the interface abstractions I described earlier. If I provide this additional way of initialization, there will always be the confusion, which way is the recommended one. Thus more complaints from users.