[Openmcl-devel] readtable

Stas Boukarev stassats at gmail.com
Fri Jun 5 07:27:58 PDT 2009


Taoufik Dachraoui <taoufik.dachraoui at wanadoo.fr> writes:

> Hi
>
> I created a new macro-character #\: to check and disallow access to not external symbols as follows:
>
> (defun check-columns (stream char)
>   (let ((ch (peek-char nil stream t nil t)))
>     (if (eql ch #\:)
> (error "access to internal symbols not allowed")
> (progn
>  (unread-char #\: stream)
>  (set-macro-character #\: nil)
>  (let ((res (read stream t nil t)))
>    (set-macro-character #\: #'check-columns)
>    res)
>  ))))
>
> (set-macro-character #\: #'check-columns)
>
> Note: according to the book ANSI Common Lisp by Paul Graham, unread-char cannot be done
> after a peek-char. But in my tests ccl did not complain.
>
> Now I would like to restore the standard readtable but failed. I tried the following:
>
> (set-macro-character #\: nil)
>
> Even if I quit ccl and launch a new image I still get the following message when I try to access a symbol using ::
>
> ? (make-package 'test)
> ? (setq test::x 1)
>
>> Error: access to internal symbols not allowed
>> While executing: MB::CHECK-COLUMNS, in process listener(1).
>> Type :POP to abort, :R for a list of available restarts.
>> Type :? for other options.
> 1 > 
>
> How do I restore the standard readtable
>
(setf *readtable* (copy-readtable)) should restore standard readtable.

-- 
With best regards, Stas.



More information about the Openmcl-devel mailing list