Boost logo

Boost Users :

Subject: Re: [Boost-users] [phoenix][lambda] lambda to phoenix translation: get sig (signature) from actor
From: Joel de Guzman (joel_at_[hidden])
Date: 2010-05-29 22:10:37


On 5/30/2010 9:48 AM, alfC wrote:
>> I'm not sure if it's a good idea to go beyond the documented features.
>> The more you do this, the more work you'll have to do in porting it
>> to Phoenix-3. What is it you are trying to do?
>
> thank you for the advise.
> What I am trying to do mixes boost.units with lambda/phoenix
> expressions
> I had a function that worked well with lambda and I am trying to make
> it work with phoenix.
> In a previous post I asked how to translate the argument, which is
> done, of the following function (called qawc) and
> now I am trying to translate the result type.
>

I am not sure if this is the best way to do it in either Lambda nor
Phoenix (I'm pretty sure that even with lambda, you are going beyond
the documentation, no?). However, I am not knowledgeable enough of the
domain you are involved with, nor do I know what qawc means.

Anyway...

In Phoenix (see Actors In Detail at: http://tinyurl.com/24wlduz),
a lambda is always an:

   actor<Eval>

The return type deduction of Eval are (given varying arguments):

   typename apply_actor<eval_type, basic_environment<> >::type
   typename apply_actor<eval_type, basic_environment<T0> >::type
   typename apply_actor<eval_type, basic_environment<T0, T1> >::type
   ...
   typename apply_actor<eval_type, basic_environment<T0, T1, ... TN> >::type

So, assuming you know your lambda-eval-type, and your arguments, you
can get the return type.

The documented "result" protocol for Eval is:

    T::result<Env>::type

where Env is your environment (See the link I provided above). Typically,
for client use, the environment is just basic_environment<...>.

HTH.

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net
http://www.facebook.com/djowel
Meet me at BoostCon
http://www.boostcon.com/home
http://www.facebook.com/boostcon

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net