On 11/18/2010 6:09 AM, Thomas Heller wrote:
> Ok ... I implemented let!
You've been busy. :-)
> Here goes the renumbering example:
> The change is in line 296 rendering RenumberFun to:
> struct RenumberFun
> : proto::fold<
> , make_pair(fusion::vector<>(), proto::_state)
> , let<
> _a(Renumber(_, second(proto::_state)))
> , make_pair(
> , first(_a)
> , type_of<second(_a) >
> The implementation of let actually was quite easy ... here is how it works:
> let<Locals, Transform> is a transform taking definitions of local variables
> the transform these locals will get applied to.
> A local definition is in the form of: LocalName(LocalTransform)
> If the specified transform has LocalName embedded, it will get replaced by
Unfortunately, this doesn't actually solve the reevaluation problem ...
it just hides it. 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.
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.
proto mailing list