Subject: Re: phoenix lambda-lambda for_each example
From: Aleksey Gurtovoy <[email-masked]>
To: "Noah Stein" <[email-masked]>
Cc: "Joel de Guzman" <[email-masked]>, "David Abrahams" <[email-masked]>, "Jaakko Jarvi" <[email-masked]>
Date: Wed, 03 Mar 2004 02:50:12 -0600

Noah Stein writes:
>> From: Joel de Guzman [mailto:[email-masked]]
>
>> I encountered this problem with phoenix's local vars too.
>> The solution I had was to use outer(arg1) to refer to the
>> outer scope:
>>
>>      for_each(arg1, push_back(outer(arg2), arg1) )( v1, v2 );
>>
>> I am also contemplating on incorporating FC++ style scopes
>> as an optional scheme:
>>
>>      lambda(seq)
>>      [
>>          for_each(seq,
>>              lambda(elem)
>>              [
>>                  push_back(seq, elem)
>>              ]
>>          )
>>      ]
>>      (v1, v2);
>>
>> but I find it too noisy for my taste ;-) Comments?
>
>
> I find it a bit noisy, too; however, is there any other solution
> that solves a 3-layer (or greater) set of scopes?  Does outer refer
> to the immediately preceding scope or the topmost scope?

FWIW, I'd expect/implement it to refer to the immediately preceding
scope, and support the nested usage like 'outer(outer(arg#))' for the
case of multiply-nested scopes.

-- 
Aleksey Gurtovoy
MetaCommunications Engineering