The Remove debug refactoring doesnt seem to remove debugs! They had the form of “something”.

Submitted by André Vieira on 15 November 2011 at 10:28

On 15 November 2011 at 10:37 Maartje tagged @maartje

On 15 November 2011 at 10:38 Maartje tagged refactoring

On 15 November 2011 at 10:40 Maartje commented:

do you have a concrete example where it did not work?


On 15 November 2011 at 10:55 André Vieira commented:

rules

rename: Block(ss) -> Block(ss')
where
	 <debug> "a"
;	new-scope( ss' := <analyse> ss )

(adapted analysis.str in the org.spoofax.examples.pl project)


On 15 November 2011 at 11:35 Maartje commented:

remove debug refactoring removes debug calls that can savely be removed as in: "x := 4 ; debug(!"x: “)”. in this case, the “a” constructs the term “a” so it is not easy to see if it can be removed savely.

possible solutions: 1) keep debug, 2) remove but report as error/warning, 3) replace with or ! (seems a bad idea), 4) try to do a more refined analysis (probably difficult)


On 15 November 2011 at 12:43 Guido Wachsmuth commented:

The example is not a bug. Removing the debug statement, will apply new-scope to Block(ss). Without a removal, it is applied to “a”. This is crucial for new-scope, as it creates dynamic rules capturing knowledge about the current scope.


On 15 November 2011 at 12:50 Lennart Kats commented:

Maybe the refactoring should give a warning or something for debug statements that change the current term?


On 15 November 2011 at 13:40 Maartje commented:

So I guess the best idea is to keep the debug but report warnings, like: “line 5: debug could not be removed”


On 15 November 2011 at 14:08 Guido Wachsmuth commented:

The error message should explain why it cannot be removed, e.g. “line 5: debug statement changes current term and cannot be removed”


On 15 November 2011 at 14:08 Guido Wachsmuth tagged lab

Log in to post comments