Let's say I need to associate symbols with directories, and this will only need to be done for a small number of boundp
symbols.
The way I see it, there are two easy ways to do that:
- Store this association in a separate variable (alist or a hash map). This way the directory of each symbol would be accessible with
(cdr (assq SYMBOL my-alist))
. - Store this in a symbol property. This way, it would be accessible with
(get SYMBOL 'my-directory)
.
Which of these would be the idiomatic way of keeping track of this information?
(defvar s 5) (put 's 'd "c:/abc/") (let ((s 4)) (message "d: %s, val: %S" (get 's 'd) s))
. And OP: why do you speak of "functions", not symbols? I must be missing something.let
-binding that dir-string symbol (which is used as the prop value) should not be a problem. (Feel free to ignore if not pertinent.)