chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Peculiar TinyCLOS specialization bit


From: Andreas Rottmann
Subject: Re: [Chicken-users] Peculiar TinyCLOS specialization bit
Date: Fri, 31 Dec 2004 00:59:01 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

"Joel Reymont" <address@hidden> writes:

> Try running the following code:
>
> (require 'tinyclos)
>
> (define-class <a> () ())
> (define-class <b> (<a>) ())
> (define-method (foo (self <b>) (a <a>)) #f)
> (define b (make <b>))
> (foo b #f)
>
> You will get "Error: call-next-method: no methods left: #<procedure>"
> since method foo is expecting an object as it's second argument and is
> getting #f.
>
> I think it should pass, though. Am I missing something?
>
The only method on the generic function foo is specialized on (<b>
<a>), while you pass (<b> <boolean>), so there are no applicable
methods. Some error is the expected behaviour. If you want it to pass,
do

(define-method (foo (self <b>) (a <top>)) #f)

or

(define-method (foo (self <b>) (a <boolean>)) #f)

instead of or additionally to 

(define-method (foo (self <b>) (a <a>)) #f)

HTH, Rotty
-- 
Andreas Rottmann         | address@hidden      | address@hidden | address@hidden
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Life is a sexually transmitted disease.




reply via email to

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