Re: Passing Global Variables Urgh.



Just as an addition to the other posts (since noone cared
to sove your "problem"):



(defvar *x* "blub")

;;; We avoid 'setq' since we already get a symbol
;;; and don't need to quote it ...

(defun modify-it (symbol)
(set symbol "newer blub"))

;;; Ok, we want to pass a _symbol_ so we better
;;; protect *x* from being evaluated before being
;;; passed th modify-it - 'quote' to the rescue ...

(modify-it (quote *x*))

; => "newer blub"

;;; ... or, as a shorthand

(modify-it '*x*)

; => "newer blub"

;;; but beware!
(let ((honk 42))
(warn "Value uf honk is ~A" honk)
(modify-it 'honk)
honk)

;;; Evaluate this expression twice and watch the
;;; warning.
;;; strange, eh?
;;; Not really: or function doesn't "see" the
;;; local bound honk and hence can't modify it.
;;; It'll try to modify the globally visible honk -
;;; if honk doesn't exist asa global (special) variable
;;; all sorts of strange things might happen ...



HTH RalfD
.