Stratego/XT JIRA  History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: STR-49
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Arthur van Dam
Votes: 0
Watchers: 1
Operations

Clone this issue
Create sub-task
If you were logged in you would be able to see more operations.
Stratego/XT

listvars as term arguments are not usable

Created: 2004-04-15 10:22   Updated: 2008-03-31 20:39
Component/s: stratego-front, srts - Stratego run-time system
Affects Version/s: None
Fix Version/s: 0.10

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
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.

 All   Comments   Work Log   Change History      Sort Order:
Arthur van Dam [2004-04-20 12:15]
ListVars are now associated correctly to LId's in the term arguments of ruledefs.
(When introducing local var scope of a ruledef, <diff> (<tvars> r, y') was used, but should have been <diff> (<tvars; map(try(?ListVar(<id>))> r, y')