[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in readtable facility

Dear lispers,

I'm using MCL2.0b1 with patch level 3. I encounterd a strange behavior
when programming readtable related things.

See this small codes:

(defun test-func (stream char)
  (list char char))

(defvar *test-readtable* (copy-readtable nil))

(set-macro-character #\! #'test-func *test-readtable*)

(defun test ()
  (let ((*readtable* *test-readtable*))

Evaluating (test) and typing !, then you will get (#\! #\!). (Of
course, this behavior is perfect.)

But if you define test-func as follows instead,

(defun test-func (stream char)
  (listen stream)
  (list char char))

and do the same thing, then you will get an error:

? (test)
> Error: No applicable primary method for args:
>         to #<Compiled Generic-function STREAM-LISTEN #x42156E>

This tells you that stream passed to test-func can't be used as an
argument of listen.

According to CLtL 2nd edition, the stream passed to test-func 'is the
input stream' (see p542). Also, listen accepts input-stream (p574).

Is this a bug in MCL2.0? Or, is this a correct behavior? I'm sorry if
this was discussed before.

Yasuaki Honda // honda@csl.SONY.co.jp
It's Sony Computer Science Laboratory Inc.