From: Thomas Wenisch (twenisch_at_[hidden])
Date: 2002-07-18 16:12:05
On Thu, 18 Jul 2002, David Abrahams wrote:
> 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?
What I mean is: I believe "x" is a typo in the comment. The name of the
variable passed as a parameter to all_permutations is "in". The function
returns a permutation_holder<> which contains all N! permutations of
"in". I believe the correct comment should read:
// return an array of the N! permutations of the array "in".
My apologies for not saying it more clearly.
> > 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.
Yes, perhaps this is true. I personally found the FSM example more
readable because I have had to solve that very problem myself in the past
(try to autogenerate code for an FSM from a table), and have never come up
with a solution as concise as what appears in the paper. Since the
problem was more familiar, I liked the example better :) However, my
opinion might not be representative of the majority of people new to
metaprogramming that are reading the paper, and that is the audience the
paper should target.
Computer Architecure Lab
Carnegie Mellon University
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk