I found out that querying a symbol's name using symbol-name adds the symbol to obarray.
(intern-soft "random-name") ; gives nil
(symbol-name 'random-name) ; adds random-name to obarray, gives "random-name" (string).
(intern-soft "random-name") ; gives random-name
My concern is that this bloats obarray with empty symbols (i.e no value or function definition). Is there
- something like
symbol-namewhich doesn't add the to the obarray? - a way to clear the obarray of "useless" (all cells other than the name cell are empty) symbols?
Edit -
I just found out that even evaluating a symbol adds it to the obarray. So I am assuming this language (or any lisp) is designed in a way that you don't have to worry about the size of obarray. Is this correct?
intern-softsupports that with its optional argument and there's some code making use of that. – wasamasa Sep 27 '20 at 08:15obarrayhave any side effects? For example, do the symbols evaluate like they always do or do we have to explicitly inform to take the symbol from the newobarray? – nomad Sep 27 '20 at 08:46