Boost logo

Proto :

Subject: Re: [proto] : Proto transform with state
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2010-11-18 13:45:36


Eric Niebler <eric_at_...> writes:
> On 11/18/2010 6:09 AM, Thomas Heller wrote:
> > Here goes the renumbering example:
> > http://codepad.org/K0TZamPb
<snip>
> Unfortunately, this doesn't actually solve the reevaluation problem ...
> it just hides it.

Yes, exactly.

> If "_a" gets replaced eagerly everywhere with
> "Renumber(_, second(proto::_state))", then that transform will actually
> get run every time. What I want is a way to evaluate the transform,
> store the result in a temporary, and have "_a" refer to that temporary.

Yes, I thought of doing this ... but could not find a solution. The question is,
do we really need this behaviour? Is replacement not enough?
Could you make up a usecase? I can not think of one ... Regarding that counting
example ... it can be solved by this pair hack.

> It's REALLY hard. The let context needs to be bundled with the Expr,
> State, or Data parameters somehow, but in a way that's transparent. I
> don't actually know if it's possible.

Very hard ... yeah. I am thinking that we can maybe save these variables in the
transform?


Proto list run by eric at boostpro.com