Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-07-18 15:17:22

From: "Thomas Wenisch" <twenisch_at_[hidden]>

> Here are my comments on the MPL paper:
> General Comments
> ================
> Permutations Example
> The permutations example used in section 1.3 of the paper is described as
> a "simple" example. However, the code is fairly complex, and uses a
> number of tricks which I would describe as advanced uses of STL. For
> example, the use of &*in to obtain the parameter for std::copy.
> Additionally, the comment reads
> // return an array of the N! permutations of x
> However, the function returns all N! permutations of the array in, x does
> not appear in all_permutations.

I don't understand that sentence. What does it mean?

> More importantly, the example of permuting an array strikes me as fairly
> esoteric, and does not motivate template metaprogramming very
> strongly. I understand the pedagogical advantage of starting with
> factorial as the canonical example of functional programming, and then
> building from there throughout section 1. However, an example that
> accomplishes something more familiar to "everyday" programming would be
> stronger.

I wrote that part of the paper, and I agree that it's too esoteric, but
like you, I couldn't come up with a better simple motivator.

> Unfortunately, I don't have anything better to suggest right now. Anyone
> else have any ideas? I will think about this some more and see if I can
> give a concrete suggestion, but I think a better example would make the
> paper more accessible.

I totally agree.

> One thing I would suggest, though, is to mention the FSM example from
> section 5 early on in the introductory material. Section 5 is a great
> demonstration of the power of MPL-enabled code generation. I think
> mentioning this problem as motivation in section 1 would be a good way to
> make the problems that metaprogramming solve more concrete for the
> uninitiated.

IMO that example is also fairly esoteric and complicated. Even mentioning
it might not be much of a help in an intro section. It would be much better
to be able to motivate metaprogramming with something more straightforward,
if possible.


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