reset newname counters
I noticed the
newnamestrategy 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
Issue Log
For deterministic code generation, you should not use
newname, but write some counter- or namespace-based name generator yourself.newnameonly 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 generatea0in one run, thena0is likely still alive in the heap the next run, so the counter continues ata1. In some cases the counter itself will be garbage collected, causing it to reset, possibly allowing it to generatea0if there is noa0alive in the heap. So based on the safety guarantees and the garbage collection interaction, there’s really no way to reliably makenewnameproduce deterministic names, even though you’d get pretty close by forcing a garbage collect.
Log in to post comments