bug-guile
[Top][All Lists]
Advanced

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

Anomalous results from is-a? and instance? on current-input-port


From: Alan Grover
Subject: Anomalous results from is-a? and instance? on current-input-port
Date: Tue, 15 Feb 2005 18:39:44 -0500
User-agent: Mozilla Thunderbird 0.7 (X11/20040615)

Guile 1.6.4
Linux xxxx 2.6.5-7.145-default #1 Thu Jan 27 09:19:29 UTC 2005 i686 i686 i386 GNU/Linux
SuSe 9.1

Some instance and class introspection procedures give anomalous results. Specifically, they seem to give false when they shouldn't.

My results (from code below, just for current-input-port). Note the #f's":
; from interactive guile
(class #<<class> <soft-input-port> 8087280>
 instance? #f
 (is-a? <soft-input-port>) #f
class-direct-supers (#<<class> <soft-port> 80872b0> #<<class> <input-port> 8084110>)
 (is-a? <input-port>) #t

Results are repeatable if tried in the same interactive interpreter, or run from a script. However, I get the following variations:

* Run from a script: (is-a? <soft-input-port>) #t
* Use my .guile: (is-a? <soft-input-port>) #t

A minimal .guile that causes the variation is:
        (use-modules (ice-9 readline))
        (activate-readline)

In another script, a generic function specialized on <input-port> was called properly when the argument was (current-input-port). So that seems to work as expected.


To reproduce:
(use-modules (oop goops))
(define (a-test x)
(display
(list
'class (class-of x) "\n"
'instance? (instance? x)  "\n"
'(is-a? <soft-input-port>) (is-a? x <soft-input-port>) "\n"
'(is-a? <soft-output-port>) (is-a? x <soft-input-port>) "\n"
'class-direct-supers (class-direct-supers (class-of x)) "\n"
'(is-a? <input-port>) (is-a? x <input-port>) "\n"
'(is-a? <output-port>) (is-a? x <input-port>) "\n"
)))
(a-test (current-input-port))
(a-test (current-output-port))
(a-test (current-error-port))

--
Alan Grover
address@hidden
+1.734.476.0969




reply via email to

[Prev in Thread] Current Thread [Next in Thread]