Re: [abc-users] Tracematch matching semantics

From: Pavel Avgustinov <>
Date: Thu, 11 Sep 2008 11:18:02 +0100

Note: Somehow this message remained in my unbox unsent, and I see there have
been some replies in the meantime.. sorry for the delay, and any repeated


Hi Jon,

Yes, this is indeed working as designed. The tracematch pattern is
matched against *all suffixes* of the program trace. Thus, after the
second 'save' event, the last two save events trigger a match, and after
the third 'save' event, the second and the third events trigger a match.

The formal semantics of the matching behaviour is laid out in our
OOPSLA'05 paper (
Note that there is an example there that is superficially similar to
yours: We define an "autosave tracematch" that automatically saves a
document every 5 actions after the last save. There, the pattern is
indeed just "action [5]" (where yours is "save [2]), however, it would
not trigger after every single action after the 5th. The reason is in
the body of the tracematch: That calls "Application.autosave()", which
matches one of the declared tracematch symbols which isn't referenced in
the pattern. This event effectively resets the matching state, since no
suffix will match the pattern until another five action events occur.

Hope this helps, do let me know if I can clarify further.

- P

Jon Oldevik wrote:
> Hi,
> I have a question about the matching semantics that tracematch supports.
> given a really a tracematch, e.g. the simple one given below, which is
> matching two subsequent calls to save: When two 'save' are detected,
> the tracematch gives a match. However, when a third 'save' is
> detected, a new match is given (rather than waiting for a fourth).
> Is this the intended semantics of tracematches?
> public aspect MatchTwoSaves {
> pointcut save(Editor e): target(e) && call (*
> tracematch (Editor e) {
> sym save after returning: save(e);
> save save {
> // we got a save+save match, now do something with it
> }
> }
> }
> Best regards,
> Jon Oldevik
Received on Thu Sep 11 2008 - 11:18:11 BST

This archive was generated by hypermail 2.2.0 : Fri Sep 12 2008 - 22:50:11 BST