Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2003-10-26 00:21:18


David B. Held <dheld_at_[hidden]> wrote:
> "Jeremy Maitin-Shepard" <jbms_at_[hidden]> wrote in message
> news:87ad7o7pxd.fsf_at_jay.local.invalid...
>> [...]
>> (This post is rather off topic, but I thought I would post it
>> anyway)
>> [...]
>> Imagine if C++ supported syntax like this:
>>
>> typedef typename {
>> type x = mpl::vector<int, bool, short, double>;
>> type y = mpl::vector<float, unsigned int>;
>> for(type it = begin<y>; it != end<y>; it = next<it>)
>> x = push_back<x, deref<it> >;
>> return x;
>> } my_vector;
>> [...]
>
> What if it looked like this instead:
>
> mpl::vector append_vector(mpl::vector x, mpl::vector y)
> {
> for (mpl::vector::iterator i = begin(y); i != end(y); ++i)
> {
> x.push_back(*i);
> }
> return x;
> }
>
> mpl::vector my_vector = append_vector(
> mpl::vector(int, bool, short, double),
> mpl::vector(float, unsigned int)
> );
>
> Of course, it will never look like that in C++, but what if there
> were a language that *did* support that kind of syntax? That's
> something I've been thinking about quite a bit lately. ;)

It would be very difficult to debug because of the side-effects.
I'm quite happy with the *functional* nature of the template processor,
thank you. An imperative template processor will open up a can of
worms. I don't even want to start imagining a step debugger at
compile time! Yaiks! No, please don't!

IMVHO, there's nothing wrong with the functional nature of the template
processor. Why make it imperative when everyone knows that
functional is better? C'mon guys! This is a step backwards!

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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