I noticed the newname strategy keeps increasing its counters even over project rebuilds and calls to editor-analyze. Sometimes the counts (randomly?) drop, but the only reliable way to restart them is to restart Eclipse.

For more deterministic code generation (which is where I use the newname strategy) it might be nice to have the counter reset at least when reloading editors, and maybe also in editor-analyze.

As far as I’ve seen there does not exist any primitive at the moment to reset newname. (newname is itself a primitive)

Submitted by Tobi Vollebregt on 10 December 2010 at 12:43

On 10 December 2010 at 13:10 Lennart Kats commented:

For deterministic code generation, you should not use newname, but write some counter- or namespace-based name generator yourself. newname only provides the guarantee of generating new names with a certain prefix that don’t exist in the current heap yet. That means that if you generate a0 in one run, then a0 is likely still alive in the heap the next run, so the counter continues at a1. In some cases the counter itself will be garbage collected, causing it to reset, possibly allowing it to generate a0 if there is no a0 alive in the heap. So based on the safety guarantees and the garbage collection interaction, there’s really no way to reliably make newname produce deterministic names, even though you’d get pretty close by forcing a garbage collect.


On 10 December 2010 at 13:10 Lennart Kats closed this issue.

On 10 December 2010 at 13:10 Lennart Kats tagged wontfix

On 10 December 2010 at 13:10 Lennart Kats tagged stratego

Log in to post comments