
On 03/16/2010 01:49 AM, Steven Watanabe wrote:
AMDG
Andrey Semashev wrote:
Yes. attr is a formatter and a filter, for example.
Oh, indeed! But.. why? Cannot one object serve both roles?
One is filter and the other is formatter. They have different interfaces (with regard to the library and the user)
Are the interfaces incompatible?
Yes. Filters and formatters do different things, how can they share the interface?
and serve different purposes (one - to compose filters, the other - formatters).
Why does this matter? spirit uses the same placeholders in both qi and karma, for instance.
I'm not a specialist in Qi and Karma internals and cannot judge on how that design decision is applicable to Boost.Log. But from my viewpoint, mixing filters and formatters is absolutely not a good idea.
Also, thread safety requirements are different.
Why? In any sane implementation that I can think of, both attr's should store the same immutable data.
The formatter attr can contain a boost::format member, which makes it thread-unsafe. Thread unsafe design is common for most formatters.