Subject: Re: phoenix lambda-lambda for_each example
From: David Abrahams <[email-masked]>
To: Joel de Guzman <[email-masked]>
Cc: Noah Stein <[email-masked]>, [email-masked], Aleksey Gurtovoy <[email-masked]>, Jaakko Jarvi <[email-masked]>
Date: Wed, 03 Mar 2004 09:32:52 -0500

Joel de Guzman <[email-masked]> writes:

> I thought about that too. Upon meditation, I realized it is
> not necessary. In this case, Phoenix has scope! That's why I
> wrote the title "lamda-lambda". Consider:
>
>      std::vector<std::vector<int> > v;
>      ...
>      for_each(arg1, for_each(arg1, cout << arg1 << ' '))
>      (v);
>
> * The first arg1 gets a std::vector<std::vector<int> >
> * The second arg1 gets a std::vector<int>
> * the third arg1 gets an int.
>
> Each lambda has its own scope. Try the attached example, if you
> are not convinced.

I'm not saying that I don't believe it can be done.
I'm saying that there's an inherent ambiguity and you need some way to
represent the other semantics, where v gets substituted for arg1
everywhere.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com