Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] Forwarding evaluation via tag
From: joel (joel.falcou_at_[hidden])
Date: 2009-09-29 12:47:20


Eric Niebler wrote:
> Also look into proto::functional::unpack_expr, which turns a Fusion
> sequence into a proto expression node. For instance, you might turn an
> N-ary expression into an (N+1)-ary expression representing a function
> invocation like (untested) ...
>
> when< nary_expr< _, vararg<eval_expr> >
> , function< vararg<eval_expr> >( // #1
> functional::unpack_expr<tag::function>( // #2
> push_front(_, terminal<functor<tag_of<_> > >()) // #3
> )
> )
> >
>
> The idea here is to create an expression that, when evaluated by
> proto::function's pass-through transform (#1), does the Right Thing.
> You can accomplish that by first building a new expression from the
> old that (a) has an extra argument in the 0th position that is a
> terminal containing your function object, and (b) has a tag type of
> tag::function. First you build a new sequence with push_front (#3),
> and then you unpack that Fusion sequence into a new expression (#2).
>
> push_front doesn't exist yet; you'll have to write it. Just create a
> callable function object that does what fusion::push_front does.
OK, I like the idea. I tried to get it working but I stumple against the
fatc that proto make_expr takes push_front() as a Sequence and don't try
to evaulate it before hand, leading to a "no size for psuh_front" erro
in fusion. I'll try to get this sorted though.

My main question is that, when and when not a transform call get
evaluated ? Like if i do
foo( bar ( _) )

is bar(_) evaluated before being evaluated by foo ?
Sometimes it seems it does and sometimes no :/

-- 
___________________________________________
Joel Falcou - Assistant Professor
PARALL Team - LRI - Universite Paris Sud XI
Tel : (+33)1 69 15 66 35

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