Boost logo

Boost Users :

From: Edward Diener (eddielee_at_[hidden])
Date: 2002-07-18 10:58:37


"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:00c001c22e4c$38ea8140$1d00a8c0_at_pdimov2...
> From: "Edward Diener" <eddielee_at_[hidden]>
> >
> > The suggestion is that you explain how to bind specific arguments to
> > boost::bind, the need to specify placeholders for all the other
arguments,
> > and also how to eventually pass arguments for placeholders. I know you
are
> > giving various examples when specifying how to use boost::bind with
> > different types of functors, but they don't explain it all in a
methodical
> > way. I find the examples good but the general mechanism eluded me when I
> > first read it. I think I understand it now but because it is not
explained
> > clearly at the beginning before you give practical examples, it made it
> much
> > harder to fathom how it all worked. BTW, as a binding mechanism I think
it
> > is great work, but I don't think you need even assume that programmers
who
> > use it even understand std::bind1st or std::bind2nd if you explain it a
> bit
> > better.
>
> This helps, thank you. One more question: it seems that you are using
bind()
> to implement closures. Are you migrating from another closure library, or
do
> you have expectations of how a closure library works, that have got in the
> way?

I am using boost::function to implement closures for a Visual C++ 3rd party
library and suggesting boost::bind as the main way to bind member functions
to my boost::function implementations. I have even provided some macros
which make binding an end user member function to the particular
boost::function closures of my classes, using boost::bind, easier. For C++
Builder, as you may know, Borland has a __closure addition to the C++
language, totally non-standard C++, which makes the usage of boost::function
and boost::bind unnecessary. Although I am coming from C++ Builder's
mechanism, I am very appreciative of the work done with boost::function and
boost::bind which makes closures a possibility using pure C++ as it now
stands.

My expectations have not got in the way once I understood how to use
boost::function and boost::bind to implement closures. I find both
mechanisms well done even if using a C++ Builder __closure extension is much
simpler ( I still like C++ Builder's __closure concept as a possible future
native type addition to the C++ language, but that discussion belongs
someplace else, probably comp.std.c++ ). It was understanding how
boost::bind actually worked which took a while and the fault may well be
mine as I restudied bind1st and bind2nd adapters to make sure I knew what
was happening there before looking at your documentation on boost::bind
again. I admit that I didn't understand intially that when binding one had
to supply all the arguments, either in the form of an actual parameter or as
a placeholder. That is one of the reasons I suggested that you present a
general explanation of the boost::bind mechanism, focusing on what binding
is, binding a specific argument, using placeholder arguments, and calling
the binding functor with actual values. I know you cover this later in
examples for the different uses of boost::bind but I think it would be much
more effective if you explain this at the beginning. However I might be
unfair in not assuming a greater degree of C++ sophistication in users of
Boost and of your implementation.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net