# Unique[] and special handling of symbols ending with a single dollar sign

### Example

Unique[x] generates a new symbol, with a name of the form x$nnn. If so then this is not correct: Unique[x$]

x$4639  I'd expect double $: x$$4639. ### Question: Is this a bug in Unique, a documentation bug or have I missed something? ### Further investigation It only happens for single  but I have failed to find any reason why not to use such names. Unique /@ {x$$, x$, x}  {x$$4694, x4695, x4696}  This has further consequences, some of which I consider bugs but I will stop here as those examples are enough for discussion. • One good reason not to use such names is that the lexical renaming mechanism used in various places will add the character to symbols in an attempt to disambiguate the same symbol appearing in different scopes. It has been suggested that we document this e.g. in Function and this is on someone's to-do list (mine, I guess). – Daniel Lichtblau Apr 27 '17 at 15:46 • @DanielLichtblau Didn't you do that already? Function / Properties&Relations / 4th example. – Kuba Apr 27 '17 at 21:15 • Yes, we do document that such rewriting takes place. What I meant it is that there is an open suggestion for Possible Issues, to the effect of "Don't use variables like this because it will interfere with rewriting in ways that are difficult to predict". – Daniel Lichtblau Apr 27 '17 at 21:32 • @DanielLichtblau I see. Let me suggest to stress that out in the tutorial linked in the answer and then add a reference in details&options of all relevant functions. Here is another victim of the special treatment for name symbols: DynamicModule[{x = .5}, {Dynamic[x], Slider@Dynamic[x]}] – Kuba Apr 28 '17 at 8:02 ## 1 Answer Symbols in the Wolfram Language aaaaa user‐defined symbol Aaaaa system‐defined symbol Aaaa global or internal system‐defined symbol aaaa symbol renamed in a scoping construct aann unique local symbol generated in a module  According to the forms of symbols, x in Unique[x] shouldn't be aaaa$$. Workaround: In: Unique["x$$"]  Out: x$$6  • That list gives a clue but notice that Unique documentation doesn't say that x has to be a 'user-defined symbol' – Kuba Apr 27 '17 at 9:01 • @Kuba The name of a symbol must be a sequence of letters, letter‐like forms, and digits, not starting with a digit.$ is a special character. – UnchartedWorks Apr 27 '17 at 9:07
• Sorry for being picky, I'm arguing with documentation not with you of course ;) So. "the name of a symbol" not the name of "a user defined symbol", and since "$" is included below it is probably considered a letter-like form. – Kuba Apr 27 '17 at 9:11 •$ doesn't belong to Letters and Letter-like Forms in Wolfram Language. reference.wolfram.com/language/tutorial/… – UnchartedWorks Apr 27 '17 at 9:55
• Ok, but again, Unique does not say it only work with "user defined symbols". – Kuba Apr 27 '17 at 10:07