I know that if I have a variable with a function name, I can call it using funcall
, like this
(setq func-ref 'my-func)
(funcall func-ref)
I am wondering if there's a similar functionality for variables (defined with defvar
), so that I can set var-ref
like this
(setq var-ref 'my-var)
and use it to get the value of my-var
and/or update it.
EDIT: I want to use this functionality in a function which takes as argument a reference to a variable that will be changed in the function.
(setq var-ref 'my-var)
and(set my-var 42)
.gv-ref
andgv-deref