Review Manager needed for Boost.Lambda2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
Greetings,

Some time ago I wrote a blog post,
https://pdimov.github.io/blog/2020/07/22/a-c14-lambda-library/, which
described how a simple lambda library can be implemented in ~50 lines using
the facilities already available in C++14's <functional> standard header.

I turned this into a mini-library, https://github.com/pdimov/lambda2, and
I'd like to submit that to Boost.

I'm looking for a review manager. The library is trivial, so managing the
review should be as easy as theoretically possible for a Boost review.

Thanks in advance.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
On Tue, 8 Sep 2020 at 17:02, Peter Dimov via Boost
<[hidden email]> wrote:
>
> I turned this into a mini-library, https://github.com/pdimov/lambda2, and
> I'd like to submit that to Boost.
>
> I'm looking for a review manager.

FYI, added to the schedule.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On 9/8/20 11:00 PM, Peter Dimov via Boost wrote:

> Greetings,
>
> Some time ago I wrote a blog post,
> https://pdimov.github.io/blog/2020/07/22/a-c14-lambda-library/, which described how a
> simple lambda library can be implemented in ~50 lines using the facilities already
> available in C++14's <functional> standard header.
>
> I turned this into a mini-library, https://github.com/pdimov/lambda2, and I'd like to
> submit that to Boost.
>
> I'm looking for a review manager. The library is trivial, so managing the review should be
> as easy as theoretically possible for a Boost review.

I'll take it. I can be the review manager. I know the subject pretty well and I'd like
to take part in Boost again.

Regards,
--
Joel

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
Joel de Guzman wrote:

> On 9/8/20 11:00 PM, Peter Dimov via Boost wrote:
> > Greetings,
> >
> > Some time ago I wrote a blog post,
> > https://pdimov.github.io/blog/2020/07/22/a-c14-lambda-library/, which
> > described how a simple lambda library can be implemented in ~50 lines
> > using the facilities already available in C++14's <functional> standard
> > header.
> >
> > I turned this into a mini-library, https://github.com/pdimov/lambda2,
> > and I'd like to submit that to Boost.
> >
> > I'm looking for a review manager. The library is trivial, so managing
> > the review should be as easy as theoretically possible for a Boost
> > review.
>
> I'll take it. I can be the review manager. I know the subject pretty well
> and I'd like to take part in Boost again.

Thanks!


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
Joel

Thank you for taking this on.  It looks very interesting.  I will be trying it out.

I don't suppose we have dated yet for the review.

Best wishes

John
________________________________
From: Boost <[hidden email]> on behalf of Joel de Guzman via Boost <[hidden email]>
Sent: 08 September 2020 18:42
To: [hidden email] <[hidden email]>
Cc: Joel de Guzman <[hidden email]>
Subject: Re: [boost] Review Manager needed for Boost.Lambda2

On 9/8/20 11:00 PM, Peter Dimov via Boost wrote:

> Greetings,
>
> Some time ago I wrote a blog post,
> https://pdimov.github.io/blog/2020/07/22/a-c14-lambda-library/, which described how a
> simple lambda library can be implemented in ~50 lines using the facilities already
> available in C++14's <functional> standard header.
>
> I turned this into a mini-library, https://github.com/pdimov/lambda2, and I'd like to
> submit that to Boost.
>
> I'm looking for a review manager. The library is trivial, so managing the review should be
> as easy as theoretically possible for a Boost review.

I'll take it. I can be the review manager. I know the subject pretty well and I'd like
to take part in Boost again.

Regards,
--
Joel

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On Tue, Sep 8, 2020 at 8:02 AM Peter Dimov via Boost
<[hidden email]> wrote:
> I turned this into a mini-library, https://github.com/pdimov/lambda2, and
> I'd like to submit that to Boost.

I'll take the reputational hit and ask the stupid questions. Why don't
we just slip this into Boost.Core or Boost.Utility and call it a day?
I mean, it is 52 lines...

Thanks

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
On Tue, Sep 8, 2020 at 1:36 PM Vinnie Falco via Boost
<[hidden email]> wrote:
>
> On Tue, Sep 8, 2020 at 8:02 AM Peter Dimov via Boost
> <[hidden email]> wrote:
> > I turned this into a mini-library, https://github.com/pdimov/lambda2, and
> > I'd like to submit that to Boost.
>
> I'll take the reputational hit and ask the stupid questions. Why don't
> we just slip this into Boost.Core or Boost.Utility and call it a day?
> I mean, it is 52 lines...

I find this question 0% stupid.  I want to know the same thing.

Zach

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On 2020-09-08 21:35, Vinnie Falco via Boost wrote:
> On Tue, Sep 8, 2020 at 8:02 AM Peter Dimov via Boost
> <[hidden email]> wrote:
>> I turned this into a mini-library, https://github.com/pdimov/lambda2, and
>> I'd like to submit that to Boost.
>
> I'll take the reputational hit and ask the stupid questions. Why don't
> we just slip this into Boost.Core or Boost.Utility and call it a day?
> I mean, it is 52 lines...

Boost.Core is a library of components generally useful in other Boost
libraries (and possibly Boost users). I don't think this new library
will be widely used in Boost libraries.

Boost.Utility is more user-oriented, but it has more dependencies than
Boost.Lambda2. So if a user wants Lambda2, he will be encumbered with
additional dependencies.

Personally, I'd prefer to minimize Boost.Core and Boost.Utility and opt
for separate libraries, where reasonable. We already have Boost.Lambda
and Boost.Phoenix, so having Boost.Lambda2 as a separate library follows
the trend.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On 2020-09-08 18:00, Peter Dimov via Boost wrote:

> Greetings,
>
> Some time ago I wrote a blog post,
> https://pdimov.github.io/blog/2020/07/22/a-c14-lambda-library/, which
> described how a simple lambda library can be implemented in ~50 lines
> using the facilities already available in C++14's <functional> standard
> header.
>
> I turned this into a mini-library, https://github.com/pdimov/lambda2,
> and I'd like to submit that to Boost.
>
> I'm looking for a review manager. The library is trivial, so managing
> the review should be as easy as theoretically possible for a Boost review.

Looking at the code, I wonder why there is "using namespace
std::placeholders". Shouldn't there be a separate namespace for
placeholders? (I also think, it goes against our header policies.)

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
Bjorn, thank you for reminding me about it.

I've been offline for several weeks and I might have missed it happened
already
(lots of communication moved to Slack too).

Mateusz Loskot, [hidden email]
(Sent from mobile, may suffer from top-posting)

On Tue, 8 Sep 2020, 20:39 Bjorn Reese, <[hidden email]> wrote:

> On 2020-09-08 19:39, Mateusz Loskot via Boost wrote:
> > On Tue, 8 Sep 2020 at 17:02, Peter Dimov via Boost
> > <[hidden email]> wrote:
> >>
> >> I turned this into a mini-library, https://github.com/pdimov/lambda2,
> and
> >> I'd like to submit that to Boost.
> >>
> >> I'm looking for a review manager.
> >
> > FYI, added to the schedule.
>
> Strictly speaking, he needs an endorsement first.
>

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
On Tue, Sep 8, 2020 at 2:28 PM Mateusz Loskot via Boost
<[hidden email]> wrote:

>
> Bjorn, thank you for reminding me about it.
>
> I've been offline for several weeks and I might have missed it happened
> already
> (lots of communication moved to Slack too).
>
> Mateusz Loskot, [hidden email]
> (Sent from mobile, may suffer from top-posting)
>
> On Tue, 8 Sep 2020, 20:39 Bjorn Reese, <[hidden email]> wrote:
>
> > On 2020-09-08 19:39, Mateusz Loskot via Boost wrote:
> > > On Tue, 8 Sep 2020 at 17:02, Peter Dimov via Boost
> > > <[hidden email]> wrote:
> > >>
> > >> I turned this into a mini-library, https://github.com/pdimov/lambda2,
> > and
> > >> I'd like to submit that to Boost.
> > >>
> > >> I'm looking for a review manager.
> > >
> > > FYI, added to the schedule.
> >
> > Strictly speaking, he needs an endorsement first.

I have not seen an official endorsement, but consider this mine.

Zach

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
Andrey Semashev wrote:

> Looking at the code, I wonder why there is "using namespace
> std::placeholders". Shouldn't there be a separate namespace for
> placeholders? (I also think, it goes against our header policies.)

This imports the placeholders into boost::lambda2. There is no scenario in
which you want to make the operators available without the placeholders, so
without this directive, you'd always need to use both

    using namespace boost::lambda2;
    using namespace std::placeholders;

This doesn't help anyone.

(Operators belong in the namespace of their arguments to be ADL-reachable,
so ideally, they would have been in std::placeholders, but I obviously can't
place them there.)


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
On 2020-09-08 22:31, Peter Dimov via Boost wrote:

> Andrey Semashev wrote:
>
>> Looking at the code, I wonder why there is "using namespace
>> std::placeholders". Shouldn't there be a separate namespace for
>> placeholders? (I also think, it goes against our header policies.)
>
> This imports the placeholders into boost::lambda2. There is no scenario
> in which you want to make the operators available without the
> placeholders, so without this directive, you'd always need to use both
>
>     using namespace boost::lambda2;
>     using namespace std::placeholders;
>
> This doesn't help anyone.

I see. I was thinking one could use it to compose std::mem_fns or native
C++ lambdas without placeholders, but apparently this is not allowed.

I noticed a few missing operators: unary +, ++, --, <<, >>, <=>, =,
<op>=. Also, unary &, but I'm not sure it's a good idea to add one. I
realize that there are no functional objects for those, but the library
could define them. Do you plan to add them?

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
Andrey Semashev wrote:

> I noticed a few missing operators: unary +, ++, --, <<, >>, <=>, =,
> <op>=. Also, unary &, but I'm not sure it's a good idea to add one. I
> realize that there are no functional objects for those, but the library
> could define them. Do you plan to add them?

I think that << and >> almost certainly belong there, and I was kind of
surprised that <functional> doesn't define function objects for them. Next
in line would be unary plus.

I'm less sure about the various op-assignments and ++/--. At the moment I'd
be inclined to skip them. And of course op= is impossible to add because it
must be a member.

As for <=>, I admit I haven't considered it at all. I haven't yet updated my
thinking to C++20.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
On 2020-09-09 00:36, Peter Dimov via Boost wrote:

> Andrey Semashev wrote:
>
>> I noticed a few missing operators: unary +, ++, --, <<, >>, <=>, =,
>> <op>=. Also, unary &, but I'm not sure it's a good idea to add one. I
>> realize that there are no functional objects for those, but the
>> library could define them. Do you plan to add them?
>
> I think that << and >> almost certainly belong there, and I was kind of
> surprised that <functional> doesn't define function objects for them.
> Next in line would be unary plus.
>
> I'm less sure about the various op-assignments and ++/--. At the moment
> I'd be inclined to skip them. And of course op= is impossible to add
> because it must be a member.
>
> As for <=>, I admit I haven't considered it at all. I haven't yet
> updated my thinking to C++20.

I also forgot operator[].

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
Andrey Semashev wrote:

> I also forgot operator[].

Must be a member. Unary *, however, probably needs to be added. *_1 < *_2 is
a common case.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
On 2020-09-09 00:51, Peter Dimov via Boost wrote:
> Andrey Semashev wrote:
>
>> I also forgot operator[].
>
> Must be a member.

Maybe it's worth providing your own placeholders then? Derive from
std::placeholders::arg and specialize std::is_placeholder. Should be
compatible with std::bind, shouldn't it? I admit, I haven't tried this,
though.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
Hi

I have been playing around with lambda2 to see what I can do.

I have an example from http://www.enseignement.polytechnique.fr/informatique/INF478/docs/Cpp/en/cpp/algorithm/for_each.html where the task is to increment an array of integers:


std::vector<http://www.enseignement.polytechnique.fr/informatique/INF478/docs/Cpp/en/cpp/container/vector.html><int> nums{3, 4, 2, 9, 15, 267};
std::for_each(nums.begin(), nums.end(), [](int &n){ n++; });


The nearest I can get with lambda2 is this:

std::for_each( nums.begin(),nums.end(), (_1 + 1) );

This compiles although I have found no way to store back the result.

John Fletcher



std::for_each - cppreference.com - polytechnique<http://www.enseignement.polytechnique.fr/informatique/INF478/docs/Cpp/en/cpp/algorithm/for_each.html>
Applies the given function object f to the result of dereferencing every iterator in the range [first, last), in order.. If InputIt is a mutable iterator, f may modify the elements of the range through the dereferenced iterator. If f returns a result, the result is ignored.
www.enseignement.polytechnique.fr

________________________________
From: Boost <[hidden email]> on behalf of Peter Dimov via Boost <[hidden email]>
Sent: 08 September 2020 22:51
To: [hidden email] <[hidden email]>
Cc: Peter Dimov <[hidden email]>
Subject: Re: [boost] Review Manager needed for Boost.Lambda2

Andrey Semashev wrote:

> I also forgot operator[].

Must be a member. Unary *, however, probably needs to be added. *_1 < *_2 is
a common case.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
Fletcher, John P wrote:

> Hi
>
> I have been playing around with lambda2 to see what I can do.
>
> I have an example from
> http://www.enseignement.polytechnique.fr/informatique/INF478/docs/Cpp/en/cpp/algorithm/for_each.html 
> where the task is to increment an array of integers:
>
> std::vector<int> nums{3, 4, 2, 9, 15, 267};
> std::for_each(nums.begin(), nums.end(), [](int &n){ n++; }); The nearest I
> can get with lambda2 is this:
>
> std::for_each( nums.begin(),nums.end(), (_1 + 1) );
>
> This compiles although I have found no way to store back the result.

With for_each, there are three possible ways to write it, none of which is
supported by Lambda2:

    std::for_each( nums.begin(),nums.end(), _1 = _1 + 1 );
    std::for_each( nums.begin(),nums.end(), _1 += 1 );
    std::for_each( nums.begin(),nums.end(), ++_1 );

Of those, the first one is impossible because op= must be a member, and the
latter two are possible in principle, but fall outside the initial scope of
the library.

There's also

    std::transform( nums.begin(),nums.end(), nums.begin(), _1 + 1 );


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Review Manager needed for Boost.Lambda2

Boost - Dev mailing list
Peter

> There's also
> std::transform( nums.begin(),nums.end(), nums.begin(), _1 + 1 );

Thank you, that is the answer which is better from the point of view of functional behaviour.  I have also been able to do a binary operation as well:

    std::transform(nums.begin(),nums.end(),nums.begin(),nums.begin(), (_1 + _2) );

I was ignorant of std::transform although I now see it has a reference on the page for std::for_each!

Thanks again

John

P.S. My email system does not make it easy to do quoting.

________________________________
From: Peter Dimov <[hidden email]>
Sent: 29 September 2020 12:35
To: Fletcher, John P <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: [boost] Review Manager needed for Boost.Lambda2

Fletcher, John P wrote:

> Hi
>
> I have been playing around with lambda2 to see what I can do.
>
> I have an example from
> http://www.enseignement.polytechnique.fr/informatique/INF478/docs/Cpp/en/cpp/algorithm/for_each.html
> where the task is to increment an array of integers:
>
> std::vector<int> nums{3, 4, 2, 9, 15, 267};
> std::for_each(nums.begin(), nums.end(), [](int &n){ n++; }); The nearest I
> can get with lambda2 is this:
>
> std::for_each( nums.begin(),nums.end(), (_1 + 1) );
>
> This compiles although I have found no way to store back the result.

With for_each, there are three possible ways to write it, none of which is
supported by Lambda2:

    std::for_each( nums.begin(),nums.end(), _1 = _1 + 1 );
    std::for_each( nums.begin(),nums.end(), _1 += 1 );
    std::for_each( nums.begin(),nums.end(), ++_1 );

Of those, the first one is impossible because op= must be a member, and the
latter two are possible in principle, but fall outside the initial scope of
the library.

There's also

    std::transform( nums.begin(),nums.end(), nums.begin(), _1 + 1 );


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
12