Here is a small example that show the problem:

 let step1 = debug(!"in step1 = "); step2{debug(!"step1 anno = ")}
     step2 = debug(!"in step2 = "); step3{debug(!"step2 anno = ")}
     step3 = debug(!"in step3 = ")
 in <step1> 1{2,3} end

will print:
in step1 = 1{2,3}
in step2 = 1{2,3}
in step3 = 1{2,3}
step2 anno = [2,3]
step1 anno = [2,3]

Submitted on 17 April 2008 at 15:51

On 17 April 2008 at 16:17 Jira commented:

STR-754, lennartkats:
Well, this behavior is consistent with matching, where it seems useful for most applications. (Also, it avoids having to construct a new term without the annotation.)

On 17 April 2008 at 19:32 Jira commented:

STR-754, martin:
I’m confused: what is exactly wrong? Can you give an example of the expected behaviour?

On 21 April 2008 at 17:43 Jira commented:

STR-754, pierron:
I am expecting the following code to succeed because annotations are manipulated by the congruence.

!Foo(){1,2}; (!(, )){id}; ?(Foo(){}, Foo(){}){1,2}

The previous code is not working but the following is:

!Foo(){1,2}; (!(, )){id}; ?(Foo(){1,2}, Foo(){1,2}){1,2}

On 21 April 2008 at 23:41 Jira commented:

STR-754, karltk:
For what it’s worth, I cannot see a problem with the current behaviour, either. In your recent examples, keeps the annotations (as it should), and the resulting term becomes (Foo(){1,2}, Foo(){1,2}){1,2}, as expected.

I do not see why you would expect (Foo(){}, Foo(){}){1,2} when using to obtain the Foo terms. If produced anything other than Foo(){1,2} from Foo(){1,2}, it wouldn’t be anymore.

Perhaps it would be instructive for advanced users if we publish the full Stratego semantics online, and perhaps in a less terse syntax than what’s used in the JSC paper?

On 22 April 2008 at 09:33 Jira commented:

STR-754, pierron:
The problem is not on .
I just don’t understand why the annotation are kept after a match or a congruence.

So, I guess I am wrong and this is the true semantic of Stratego …

On 22 April 2008 at 12:29 Jira commented:

STR-754, karltk:
That’s by design. Older compilers, pre 0.16, used to forget the annotations. This meant that you had to write very ugly patterns when you needed to propagate annotations. It was decided that propagating annotations should be the default behaviour. I think this is what you are seeing here and perhaps did not expect.

Log in to post comments