Re: is-a? implemented, possible bug.
> Clifford Beshers writes
>
> Well, I was wrong, class-direct-supers takes a class, not an instance,
> so the function I wanted is possible.
>
> In include it here, along with a mysterious transcript, which I think
> might reveal a bug in the STk interpreter.
>
> When I (load "isa.scm") the first time, is-a? gives the wrong answer,
> but if I load it again, it give the correct answer. Can anyone
> explain this as an error in my code?
>
This is not a bug. The problem arises because is-a? is a macro which is defined
in stklos.stk. It is defined as
(define-macro (is-a? obj class)
`(and (member ,class (class-precedence-list (class-of ,obj))) #t))
This definition is auto-loaded with your first define-class and it overloads
your definition. Thigs go wrong because of the parameter order which is
different between your is-a? and STklos one.
Second loading overload Stklos definition and things go well.
BTW, to answer to the initial question, is-a? is already defined in STklos ;-)
-- Erick
Received on Mon Jan 08 1996 - 09:26:28 CET
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST