Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-04-12 14:14:04


On Sat, Apr 12, 2008 at 6:40 PM, Daniel Walker
<daniel.j.walker_at_[hidden]> wrote:
> On Fri, Apr 11, 2008 at 3:48 PM, dan marsden <danmarsden_at_[hidden]> wrote:
> > ><gpderetta_at_[hidden]> wrote:
> > >> If there is a possibility to extend the review period of another week,
> > >> I'll take sometime to try the library, possibly with different
> > >> compilers. This may also let other boosters have time write their own
> > >> review (even if strangely so far no one else seems to have shown
> > >> interest).
> > >>
> > >> If you think that the review should still end the 13th, I'll wrap up a
> > >> review for today.
> > >
> > >Ditto. I have an interest in the problem domain Egg addresses, and
> > >from what I've read, I like Shunsuke's approach. But I'm just now
> > >sitting down to take a real look at it. I can wrap up a review today,
> > >but if you don't mind extending the review period, I think the
> > >discussion could benefit from more time.
> > >
> > >Thanks,
> > >Daniel Walker
> >
> > I do intend to extend the review period by a week. I appreciate that Egg
> > is a big library, and it takes a bit of time to review fully. So no need
> > to rush a review, but please do put them in before the end of next week.
> > Currently the review count sadly still sits at zero, so your reviews will
> > be gladly received thanks!
>
> Unfortunately, I believe I'm going to have to renege on my review.

that's unfortunate! :(

> After spending some time with Egg, I see that its scope goes way
> beyond my initial interest. I'm afraid I can't do it justice in a
> review at this time. However, I will share some of my first
> impressions.
>
> My initial interests in Egg stems from my experience last year looking
> into the whole lambda/result_of compatibility issue (as some of you
> may remember since you gave me great feedback and advice!). It was
> fairly simple to modify lambda to work with TR1 result_of. (I think my
> patch may have gotten lost in the SVN migration.) I also tried to
> bring lambda completely up to date by making it play nicely with TR1
> bind and placeholders as well. But the project died under feature
> bloat; bind and placeholders were too much for me, or at least, it got
> too tedious to keep my interest. I think it doesn't really matter,
> though. Given the most recent draft of C++0x (n2588), there will no
> longer be result_of/lambda compatibility problems as std::result_of
> will always work by fiat - even with lambda-style functors.

Yes, but lambda will still expect bound funcions to use the sig
protocol. Unless it
is modified to use boost::result_of of course.
I think that just making lambda a result_of compatible (both ways) is
enough. Bind compatibility is not necessary.
Do you think you could resurrect the patch.

> Actually,
> things are progressing so quickly with C++0x that Boost.Lambda itself
> may be made obsolete by the new lambda language extension (n2550),
> which apparently was adopted sometime in the last six weeks. I think
> that's great news! But I'm not sure what it means for Egg.

I wish it was that easy! C++0x lambdas are monomorphic. Support for
polymorphic lambdas has been dropped because of feared implementation
problems (i guess it was just that monomorphic lambdas had an higher
chance of being standardized with such a tight time constrain).

And anyways, in some cases boost.lambda has notational advantages with
respect of explicit lambdas (especially for very small functions)

>
> Egg seems to have a lot of valuable components that may fill a niche
> in the existing paradigm for functional programing in C++, but the
> shape of that niche is changing as more classic boost techniques are
> transmuted into the standard and newer boost libraries come online. So
> there's an unfixed boundary between advancing the cause of functional
> programing and reinventing existing primitives.

I think that mainstream C++ is nowhere near to what FC++ could provide
5 years ago. Egg brings it a bit closer.

> For example, in C++03
> (and C++0x) there's a need for more flexible/powerful function
> parameters. C++0x variadic functions provides for a variable number of
> type-safe parameters, but what if a user wants to change their order
> or name them? In other words, in either standard, when users need more
> advanced function parameters, how does Egg relate to Boost.Parameter?

ATM it wouldn't be pretty to have them cooperate without built in
support. On the other hand combining both libraries wouldn't be hard.
In fact I think that having Boost.Parameters
macros automatically generate egg-boosted function objects
(pipability, result_of compatibility, etc) would make a great user
interface.

> Another example: there's a long standing practice of currying
> functions with bind, which will be standardized in C++0x. How does
> Egg's curring "function adaptor" relate to std::bind? (These are just
> some questions that jumped out at me on my first impression. I haven't
> spent a lot of time trying to reason through the documentation.)
>

They are just two different ways to do partial application. Both
return result_of compatible function objects. They would work just
fine togheter (you can bind a curryied object and viceversa)

> Still, I think it is a noble ambition to create the equivalent of
> Boost.Iterator for functions - i.e. to do for std::unary_function and
> std::binary_function what Boost.Iterator did for std::iterator. Surely
> Egg represents progress toward that goal. Perhaps if Egg were
> repackaged/refocused to become a more comprehensive Boost.Function (a
> true counterpart to Boost.Iterator: intuitive and accessible), it
> would draw wider interest.

I agree with that.

> I'm not sure though, because by nature
> functors may be harder to package/sell than iterators.

we will have to wait and see :).

-- 
gpd

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk