[Openmcl-devel] readtable

Taoufik Dachraoui taoufik.dachraoui at wanadoo.fr
Fri Jun 5 15:07:07 UTC 2009


On Jun 5, 2009, at 4:27 PM, Stas Boukarev wrote:

>
> 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.
>
Sorry, I solved the problem. It was my fault, the set-macro-character  
was defined in .ccl-init.lisp file

-Taoufik




More information about the Openmcl-devel mailing list