|
Boost : |
Subject: Re: [boost] [log] Boost.Log formal review closing down
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-03-18 12:51:44
Andrey Semashev wrote:
> On 03/18/2010 12:32 AM, vicente.botet wrote:
> > Andrey Semashev wrote:
> >> void my_formatter(std::ostream& strm, logging::record
> >> const& rec)
> >> {
> >> logging::extract< unsigned int>("LineID",
> >> rec.attribute_values(),
> >> lambda::var(strm)<< lambda::_1<< ": ");
> >>
> >> logging::extract< severity_level>(
> >> "Severity",
> >> rec.attribute_values(),
> >> lambda::var(strm)<< "<"<< lambda::_1<< "> ");
> >>
> >> strm<< rec.message();
> >> }
> >
> > Sorry I find this yet clearer
> >
> > void my_formatter(std::ostream& strm, logging::record const& rec)
> > fmt::stream
> > << attr< unsigned int>("LineID")
> > << ":<"<< attr< logging::severity_level>("Severity")
> > << "> "<< message()
> > }
>
> Then the current lambda syntax is your friend.
Vicente's corrected version:
void
my_formatter(std::ostream & strm, logging::record const & rec)
{
fmt::stream << rec.line_id() << ": <" << rec.severity_level()
<< "> " << rec.message()
}
I doubt the lambda version can be clearer than that and it would certainly lead to more chances to make hard to diagnose syntax mistakes. Concerns from others about reinvention, in this case inventing your own lambda support, means that users cannot apply whatever knowledge they may have with using other lambda libraries to understanding errors in using yours. Vicente's suggested syntax is clear, simple, and permits meaningful, direct compile diagnostics. It is worth serious consideration.
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk