[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in readtable facility
- To: info-mcl@cambridge.apple.com
- Subject: Bug in readtable facility
- From: Yasuaki Honda <honda@csl.sony.co.jp>
- Date: Wed, 12 Feb 92 12:13:22 +0900
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*))
(read)))
-----------------------------------------------------
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:
> (#<CCL::TERMINAL-IO-RUBOUT-HANDLER #x531CC1>)
> to #<Compiled Generic-function STREAM-LISTEN #x42156E>
> While executing: #<STANDARD-METHOD NO-APPLICABLE-METHOD (T)>
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.