STR-13: Variable unbound in dynrule in dynrule
https://mail.cs.uu.nl/pipermail/stratego-bugs/2004-January/000229.html
Submitted on 18 March 2004 at 10:32
Issue Log
STR-13, adam:
When lifting a dynrule with another rules block in its condion,DynRule1 : t1 -> t2 where rules(DynRule2: …)
that rules block has not been lifted yet. Thus, for determining the contextvars in the RHS and condition of the rule to be lifted, the tvars of a rules block is determined. The current tvars implementation always considers all vars in a rules block to be locally bound, resulting in an empty list:
<tvars> |[ rules (..) ]| => []
This is incorrect, but done out of safety: for dynrule lifting, all contextvars should be returned, and the tvars (and underlying free-variables) has no knowledge of the ContextVar rule that propagates this information. Consider:
?x
; |[ rules (A: x -> z) ]| => [Var(“x”)]
; |[ rules (B: z -> x) ]| => [Var(“x”)]For both A and B, the only context-bound var is x, this not depends on its position in a LHS, RHS or condition, but merely on the fact that x was previously bound and had become a context var.
Probably a redesign of the determination of contextually bound vars should be specifically aimed at dynamic rules/ContextVar-checking.
Log in to post comments