3

When is it appropriate to use generated symbols(varname#) in clojure? What are the specific examples?

Sergey
  • 11,548
  • 24
  • 76
  • 113

1 Answers1

3

They are mostly used in macros so that the symbols you defined in macro doesn't conflict with the symbols that are defined in the same lexical scope when the macro is called. Using auto generated symbol would allow to avoid this kind of conflict (this concept is AKA hygienic macros).

Ankur
  • 33,367
  • 2
  • 46
  • 72
  • yeah, thanks, do you see any other cases because what you've described is the only situation when I've seen generated symbols? – Sergey Jun 04 '12 at 11:34
  • You can use this link to find various use of `gensym` https://github.com/search?q=gensym&repo=&langOverride=&start_value=1&type=Code&language=Clojure – Ankur Jun 04 '12 at 11:40