Boost logo

Boost :

From: vesa_karvonen (vesa_karvonen_at_[hidden])
Date: 2002-01-16 10:51:03


--- In boost_at_y..., Douglas Gregor <gregod_at_c...> wrote:
> On Wednesday 16 January 2002 08:37 am, you wrote:
> > I'd like to hear suggestions for naming a new repetition
primitive to
> > be added to the preprocessor library. Currently I've named the
> > primitive as BOOST_PP_REPEAT_WHILE()
[...]
> This has all the makings of a C++ 'for' loop, so why not call it as
such?

hmm... Sounds nice and short. However, FOR sounds very similar in
purpose to WHILE, while REPEAT_WHILE is actually more like REPEAT.
hmm... I got an idea. How about GENERATE?

GENERATE certainly doesn't sound like WHILE. Hmm... GENERATE is
perhaps a bit too abstract. It doesn't say anything about what or how
something is being generated.

I think FOR is better (than GENERATE or REPEAT_WHILE). After all,
this is the preprocessor, so I think that the context makes it
obvious not to expect FOR to necessarily be too similar to WHILE and
to assume that it probably generates something iteratively.

> #define BOOST_PP_GENERATE(D,C,F,I) /* ... */
>
> 'D' is the initial value of the induction variable, 'C' is the
condition, and
> 'F' is the increment expression. 'I' is the body of the loop, but
of course
> it needs to be a macro parameter for things to work.

By the way, in the preprocessor it mostly does not matter, but in
functional languages that support partial application, the data being
inspected is usually the last argument to the (higher order)
function. The purpose of this is to make it easier to compose new
(first order) functions.


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