List variables don't work in testing language
In “normal” interpreted stratego code this
x* := [2, 3];
![1, x*, 4];
debug
outputs:[1,2,3,4]
While in the testing language, this
test z
x* := [2, 3];
![1, x*, 4]
results in:[1,[2,3],4]
So apparently, list variables aren’t handled (desugared?) properly by the interpreter.
Spoofax version: 0.6.1.4-r23707
Submitted by Tobi Vollebregt on 9 December 2011 at 17:07
Issue Log
I think the test is correct, it shoudn’t be flattened
The testing language crudely implements interpretation with some calls to desugarings in the Stratego front-end. I guess one of them is missing. The flattening behavior of x* variables is what is expected here. It especially works wonders with concrete syntax.
Is this behaviour triggered by the variable name, i.e. the *, or do I get this for any name? Seems to be an interesting feature for the code generation assignment.
wow that is a nice solution indeed for code generation
Guido: it is triggered by the star.
It’s a bit of an esoteric feature though. Not a lot of people know it, and it may violate the principle of least surprise. It also doesn’t work as one may expect when used in matching. I wouldn’t teach this to the students :)
Log in to post comments