Boost logo

Boost :

From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2002-03-18 11:55:39

Agreed, the try/catch stuff, complicate loops etc. may be a bit too much
as lambda expressions. The simple control structures (if_then,
if_then_else), on the other hand, are quite convenient.
Just some silly example:

for_each(a.begin(), a.end(), if_then(_1 < 0, _1 = 0));

Having if statements, loops are quite natural addition.

And being able to throw an exception can be handy:

for_each(a.begin(), a.end(),
  if_then_else(_1 < 0,
              throw_exception(bind(constructor<std::exception>(), "negative")),

And being able to throw, wht not catch?

I noticed Gary posted some rationale too. So the complex stuff in the
library is partially there as a 'proof of concept'.

> > I don't see for loops and try/catch blocks as necessary parts
> > of a lambda library; of course this is only my personal opinion,
> and I am
> > free to not use the features I don't find appropriate, so this is
> not a
> > major problem;

control structures and exceptions are in separate include files,
so one does not pay what one does not use.

> it's only that this epic scope could prevent lambda
> from
> > being added to the standard library.

Agreed, BLL exception handling etc. are probably not features I'd
suggest to be added to the standard library. For standard library,
some branches would obviously get chopped away - for boost, I think
it's ok to have a richer set of features.

 ( Another feature I don't see
> a need of
> > is currying support. It seems added just because it's possible, not
> because
> > it solves a practical problem.

This is funny. Adding currying was initiated by Jeremy Siek's suggestion:
"Jaakko, you know what would be cool. If you could write something like
So, you're absolutely right, there was no urgent practical problem that
needed currying. I'm not sure there's a need to remove it though.


Boost list run by bdawes at, gregod at, cpdaniel at, john at