Boost logo

Boost :

From: Brian McNamara (lorgon_at_[hidden])
Date: 2004-02-17 22:05:35

On Wed, Feb 18, 2004 at 01:58:58AM +0000, Matthew Vogt wrote:
> Couple of questions:
> What are the features of fcpp::lambda that monads depend on, that
> boost::lambda does not provide?

Well, technically you don't even need lambda to implement monads. But
to do monads well/easily, you need syntax sugar (along the lines of
Haskell's "do" notation or FC++'s comprehensions). This sugar requires
explicit lambda variables (the same kind you see in FC++ lambda's
let/letrec). It's unclear to me if/how to do that with (or extend)
boost::lambda in a natural way to get this.

You also need to nest lambdas more often with monads. This is easier to
do with explicit lambda (like FC++) than with boost::lambda (which has
"protect" to help with this).

There are also nits, like FC++'s letrec and if1/if2, which have come in
handy in the implementation of certain monad functions, for various
obscure reasons.

This is a pretty rambling and vague-sounding answer, I suppose, hrm.

> Are these features not able to be implemented in boost::lambda (given the
> current design), if that were desirable?

I think they don't "mesh well" with boost::lambda's design. While
"anything's possible", my impression is that it's hard to design one
tool that is as good at doing what boost::lambda does well and is
simultaneously also good at doing monads; in a single design
incorporating both, one or the other has to "suffer" a bit.

-Brian McNamara (lorgon_at_[hidden])

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