(require 'stdlib) ;; create a new namespace (obarray) (define ns (make-vector 64 nil)) ;; create a symbol in the namespace, and define a reference to it ;; (`intern' returns existing symbols, and creates non-existing ones) (define foo-ref (intern "foo" ns)) ;; set its value: not setq! (set foo-ref '(1 2 3)) ;; foo-ref's value is the synmbol foo, as interned in the new namespace ;; it's not defined in the normal namespace (condition-case err (printf "foo = %s\n" foo) (error (puts err))) ;; get its value (puts (symbol-value foo-ref)) ;; is it possible to reference ns:foo directly? (define direct-link-to-foo (symbol-value foo-ref)) (puts direct-link-to-foo) ; (1 2 3) (setq direct-link-to-foo ; operates in the global namespace (map (lambda (x) (* x x)) direct-link-to-foo)) (puts direct-link-to-foo) ; (1 4 9) (puts (symbol-value foo-ref)) ; (1 2 3) !!! back in ns namespace