Boost logo

Boost :

From: joel de guzman (djowel_at_[hidden])
Date: 2002-04-13 09:09:55

----- Original Message -----
From: "Vesa Karvonen" :

> Joel de Guzman:
> >If knowledge of 'fold' et al is required to write an MPL
> >algorithm, then it contradicts its primary goal.
> I'm not sure about what you are talking about here. I thought that the goal
> of MPL is to facilitate template metaprogramming. One of the things provided
> by MPL (in order to facilitate template metaprogramming) is a sequence
> abstraction and a set of algorithms (higher order functions) for
> manipulating sequences. I don't see how this would contradict the goal of
> MPL.

Exactly! The keyword here is "facilitate".

> >Now you are saying that one needs to learn FP (specifically higher
> >order functions) to write an MPL algorithm?
> No, I don't think that it is strictly necessary to learn about higher order
> functions in order to write algoritms using the MPL, but I can't see why
> someone would want to waste time writing the same pattern matching +
> recursion patterns over and over again.

True **IFF** the time required to learn how to use MPL's version of fold
correctly is less than the time spent when writing an algorithm from
scratch using the tried and true pattern matching + recursion patterns.

> >I thought that
> >the reason why there was the concept of mutators, erase, replace
> >etc. was to make it more familiar to the typical STL programmer.
> Some of the terminology used in MPL is borrowed from STL, which borrowed
> some of the terminology from functional programming languages. AFAIK the
> idea is to make it easier for STL programmers to understand MPL. This does
> not imply that the MPL primitives would be any less functional.
> 'erase' and 'replace' are reasonable names for functions in a functional
> setting. Even in FP languages some list manipulation functions may have
> names that one might confuse to be imperative.

I have this itch to ask for examples. However, if there are indeed FP
languages that uses imperative sounding names, is this a justification?
Some FP languages are not pure. The C++ template metaprocessor
*IS* pure.


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