Consider the following test module
———-
module parse-test
imports tuple-cons list-cons list-basic list-misc term-io
strategies
main = <aux-InlineFun(|“foo”, [1, 2], (“foo”, [1, 2]))> (“g_0”, [“x”,“y”], (4,3), 2)

rules
aux-InlineFun(|f, t*, h_0):
(“g_0”, v*, t, nargs) -> 37
where debug(!"matched LHS: ");
!t*; debug(!"built listvar from term arg: ")
———-

Now running it, gives unexpected behaviour:
[adam@madras:misc]$ ./parse-test
matched LHS: (“g_0”,[“x”,“y”],(4,3),2)
./parse-test: rewriting failed

The term argument parses as a DefaultVarDec(“t*”) as expected, the !t* parses as Build(Var(ListVar(“t*”))), but this building fails.
The reason is that Var(ListVar(“t*”)) is not known at all within the rule-body (I can even match it against any fresh term).

Should we fix the availability of t*, or not? In this latter case, we may need to reject listvar-ids as term arguments, but that’s not very elegant either.

Submitted on 15 April 2004 at 12:22

On 20 April 2004 at 14:15 Jira commented:

STR-49, adam:
ListVars are now associated correctly to LId’s in the term arguments of ruledefs.
(When introducing local var scope of a ruledef, ( r, y’) was used, but should have been (<tvars; map(try(?ListVar())> r, y’)

Log in to post comments