Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-06-26 14:00:01


From: "Samuel Krempp" <krempp_at_[hidden]>
> On Wed, 2002-06-26 at 16:26, David Abrahams wrote:
> > I'm a bit lost. Have your looked at the MPL paper Aleksey and I wrote,
>
> I must confess I hadn't..
> Now that I did (by the way, it's brilliant, and quite exciting to read),

Wow, high praise! Thank you so very much. It's still very rough, but I
think we've had enough time away from it that we should finish it now and
get it published somewhere...

> I realise that I was not aware that in your mouth 'metafunction' has a
> precise meaning given by the conventions stated by this paper.
>
>
> But until I had read this paper, my intuitive convention for
> metafunctions in C++ was :
>
> template<typename T> class f;
>
> then T is the argument of the metafunction f, and
> f<T> its result.
>
> > It's a question of how you define "metafunction". Obviously, definining
it
> > in a way which always wraps is not very useful. Such a metafunction can
> > never "return" int, for example.
>
> Yes, that's whay I thought that metaprogramming vocubalary would never
> be more than analogies when applied to C++..

typedef templates would of course fix this problem, but still not the
problem of higher-order functional programming (e.g. returning a
metafunction from a metafunction). For that you really need metafunction
classes, which are fortunately already legal C++.

I guess with typedef templates you could simplify the invocation syntax for
metafunction classes a little.

> A more poverful convention like yours makes it possible.

It's really Aleksey's convention; I just help him to explain it.

> and then, okay, the metafunction really is identity..
>
> That'll teach me for participating in a thread without being aware of
> all the pre-requisite knowledge !

Don't worry; I do it all the time. Hopefully people are forgiving...

-Dave


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