[Ecls-list] Ecls-list digest, Vol 1 #330 - 1 msg
Goffioul Michael
goffioul at imec.be
Fri Nov 19 08:35:08 UTC 2004
> Outside the file:
>
> (load "custom")
>
> (defparameter *saved-readtable* *readtable*)
> (setf *readtable* *custom-readtable*)
> #c(ustom-syntax)
> (setf *readtable* *saved-readtable*)
The fact is that even if I type my code directly at ECL prompt,
the readtable change is not taken into account. I tried your
proposal in the piece of code below, but it still doesn't work:
testmacro.lisp:
(defvar +database+ (make-hash-table))
(setf (gethash 's1 +database+) "value1")
(setf (gethash 's2 +database+) "value2")
(defun dollar-macro-reader (stream char)
(declare (ignore char))
(let ((sym (read stream t nil t)))
`(gethash ',sym +database+)))
(defparameter *custom-readtable* (copy-readtable nil))
(set-macro-character #\$ #'dollar-macro-reader t *custom-readtable*)
(setf *readtable* *custom-readtable*)
(print $s1)
ECL session:
> (load "testmacro")
;;; Loading #P"testmacro.lisp"
"value1"
#P"testmacro.lisp"
Top level.
> (setf *readtable* *custom-readtable*)
#<readtable 00973050>
Top level.
> $s1
The variable $S1 is unbound.
Broken at EVAL.
>>
Thanks.
Michael.
More information about the ecl-devel
mailing list