Boost logo

Boost :

From: Daniel Walker (daniel.j.walker_at_[hidden])
Date: 2008-04-14 23:04:14


On Sat, Apr 12, 2008 at 6:26 PM, shunsuke <pstade.mb_at_[hidden]> wrote:
> Daniel Walker wrote:
> > 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. 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?
>
> For Egg, named parameters facility also should be a FunctionAdaptor.
> E.g.
> named(plus)(left=1, right=2);
> Actually old Egg had such a FunctionAdaptor.
> I removed it in honor of Boost.Parameter.

Maybe there's some way it could come back... either using
Boost.Parameter or being used by Boost.Parameter. I'm not sure, and
named parameters are not a must have feature for me. I'm just trying
to see where Egg fits into the larger picture.

>
> > 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.)
>
> Assume std_bind is a FunctionObject type which represents std::bind:
> X_lazy<std_bind> std_lazy;
> std_lazy(plus)(_1, 2)(1);
>
> std::bind can be a customization point of egg::lazy.
> IMO, bind interface is legacy.
> (In fact, to implement std_bind is too difficult,
> and bll::bind is enough. So, Egg skips it.)

See, I think of std::bind as becoming a staple - something that
programmers will use as commonly and readily as std::vector. I would
look at std::bind as a primitive, fundamental idiom of functional
programming in C++, which functional programming libraries should
build on and extend. By doing so you build on the existing
expectations and expertise of potential users, which lowers barriers
to adoption and generally makes their lives easier.

Daniel


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