|
Boost : |
From: David Greene (greened_at_[hidden])
Date: 2006-06-07 15:12:35
David Abrahams wrote:
> "David A. Greene" <greened_at_[hidden]> writes:
>>It is also, IMHO, one of the best practical examples of template
>>metaprogramming.
>
> I just want to clear something up about this. It's not directed at
> PQS in particular, but at the whole domain of dimensional analysis as
> an example of TMP.
>
> Dimensional analysis is really a very poor example of what TMP can do:
> interesting TMP involves some generation of code that actually "does
> something," as in the state machine example in C++TMP or Blitz++
> expression templates or Boost.Lambda. Dimensional analysis basically
> only adds error messages where they wouldn't otherwise have been.
Not to nitpick, but I didn't say "interesting," I said "practical
example." Catching these kinds of errors at compile-time is immensely
practical. Not that lambda, etc. are not, but dimensional analysis is
something that most programmers can grasp immediately, amking it a
very good example of the usefulness of TMP.
Essentially, TMP is being used to extend the type system. When I
talk to, say, Java users about TMP, this is something they can grasp.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk