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: Joel Reymont
Subject: Re: [Chicken-users] Peculiar TinyCLOS specialization bit
Date: Fri, 31 Dec 2004 10:45:37 +0000

> Andreas Rottmann wrote:

>I'm pondering on extending TinyCLOS with predicate dispatch. You then
>could express (instance of class <a> or #f).

I think the following is a better approach than my original one. Assuming
object slot:

(define-method (obj-ref! (self <foo>)) 
    (slot-ref self 'obj))

(define-method (obj-set! (self <foo>) (obj <obj)) 
    (slot-set! self 'obj obj))

(define-method (obj-clear! (self <foo>))
    (slot-set! self 'obj #f))

and boolean slot:

(define-method (flag? (self <foo>)) 
    (slot-ref self 'flag))

(define-method (flag-set! (self <foo>)) 
    (slot-set! self 'flag #t))

(define-method (flag-clear! (self <foo>))
    (slot-set! self 'flag #f))

    Joel

-- 
OpenPoker: The Linux of poker software
http://wagerlabs.com/forums
* Tenerife * Canary Islands * Spain





reply via email to

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