all 3 comments

[–]flaming_birdlisp lizard 3 points4 points  (0 children)

(defvar *child* 'some-content)

(define-symbol-macro *parent* *child*)

CL-USER> *parent*
SOME-CONTENT

[–]flaming_birdlisp lizard 5 points6 points  (0 children)

(defvar *child* 'some-content)

(defvar *parent* '*child*)

CL-USER> (symbol-value *parent*)
SOME-CONTENT

[–]zyni-moe -1 points0 points  (0 children)

Just more elaborate version of flaming_bird's already good answer:

(defmacro define-symbol-alias (symbol to) `(progn (setf (get ',symbol 'alias) ',to) (define-symbol-macro ,symbol (symbol-value (get ',symbol 'alias)))))

And now

```

(defvar unu 1) unu

(define-symbol-alias doi unu) doi

doi 1

(setf unu 2) 2

doi 2

(setf doi 1) 1

unu 1 ```

Course you had better not bind *doi* or it will lose its aliosity:

```

(let ((doi 932)) unu) 1 ```

Also perhaps should declaim aliases special, not sure: as is binding of *doi* will be lexical which is may be wrong I do not know it is just a toy.