Boost logo

Boost :

From: Vesa Karvonen (vesa_karvonen_at_[hidden])
Date: 2002-04-08 02:13:22

David Abrahams:
>Man, the doc for this library is still hard to use! It's like a
>tempting treat that's just out-of-reach. Memnonic names instead of
>single letters for the parameters would really help a lot!

I'll see what can be done.

>Is there an operation like "bind" for the PP lib?

I recall implementing some experimental macros for closures, but I think
that they were very limited in capability and suffered badly from the
limitation that the same macro can not be expanded twice. Since I couldn't
think of a robust enough way to implement closures, I dropped the idea.

I recall the basic idea was to represent a closure as a tuple:


Then a macro, CALL, was used for expanding closures:


The CALL macro would either expand to a new closure (appending PARAMS to
BOUND_PARAMS and decrementing PARAMS_NEEDED cnt) or expand the MACRO of the
closure if there were enough parameters.

The main problems with this approach are:
- calling a closure requires special syntax
- CALL can not be expanded recursively

In order to avoid the expansion problem, it might be possible to do
something like this:


The trick is that neither the CALL_CLOSURE nor the WITH_PARAMS are actually
expanded recursively. Rather the macro expansion occures during a subsequent

The main problem remains that calling a closure does not use the same syntax
as calling an ordinary macro.

Chat with friends online, try MSN Messenger:

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