GENSYM-NAME-STICKINESSGENSYM because the argument is `sticky' and such stickiness can lead to confusion. The problem is that if any application (usually a macro) uses the gensym argument at all, then all applications are forced to. If they do not, they risk finding that the `helpful' argument supplied in some previous call will be harmful to them.GENSYM, it does NOT have a side-effect on GENSYM's internal state.
Introduce a new variable, *GENSYM-COUNTER*, which holds the state of the gensym counter. That is, the next symbol generated by GENSYM will be number n. The initial value of this variable is not defined, but must always be a non-negative integer. This variable may be either assigned or bound by users at any time, but always to a non-negative integer.
Deprecate the use of a numeric argument to GENSYM.
GENSYM lookalikes because they know the system's GENSYM has an invasive effect. This defeats the primary intended function of GENSYM, which is to satisfy the most common idiomatic use of MAKE-SYMBOL.
The stickiness of the GENSYM prefix was an attempt to be gratuitously compatible with Maclisp, at the expense of good programming pratice.
Users who need the old behavior of GENSYM can trivially implement that behavior using MAKE-SYMBOL.
Occasionally you want to reset the GENSYM counter so that, for example, you can get the compiler to generate the same symbol names again (good for comparing results to see what really changed).
;; #1: Test stickiness of name part. (CHAR-EQUAL (CHAR (SYMBOL-NAME (SECOND (LIST (GENSYM "A") (GENSYM)))) 0) #\G) => NIL ;under CLtL => T ;under this proposal
;; #2: Test stickiness of number part.
(= (PARSE-INTEGER (PROGN (GENSYM 6789) (STRING (GENSYM "G"))) :START 1)
6790)
=> T ;under CLtL
=> NIL ;under this proposal (except when *gensym-counter* happens to align)
;; #3: Illustrate use of new variable.
(STRING= (SYMBOL-NAME (LET ((*GENSYM-COUNTER* 43)) (GENSYM "FOO")))
"FOO43")
=> T ;under this proposal (not meaningful previously)
If any implementations currently use a more compact representation for the internal state of GENSYM than a variable holding a string and a separate variable holding an integer, they might be forced to change. Even then, the change would proabably still be quite small.
GENSYM do not depend on the stickiness of the name, so the change would be compatible. In some cases, the change would be an improvement. Even in the worst case where someone depends on stickiness, it's extremely straightforward to write the couple of lines of code to produce an application based on MAKE-SYMBOL that is at least as flexible as GENSYM, and often moreso.GENSYM (or using GENSYM altogether) in many situations where they ought not have to.Making the gensym counter visible as a variable means that people will be able to bind the gensym counter locally when they don't want to affect the global counter.
GENSYM function for nearly every one of the dozen or so large systems that he's written or worked on in the last decade in order to get around the stated problem. Others have suggested similar experience.
Pitman and Steele support LIKE-TEFLON.