[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #846: coops: define-method does not redefine
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #846: coops: define-method does not redefine |
Date: |
Thu, 17 May 2012 21:47:33 -0000 |
#846: coops: define-method does not redefine
-------------------------+--------------------------------------------------
Reporter: megane | Owner:
Type: defect | Status: new
Priority: major | Milestone: 4.8.0
Component: extensions | Version: 4.7.x
Resolution: | Keywords:
-------------------------+--------------------------------------------------
Comment(by megane):
You can get the desired effect when using modules. In this case some
trickery is needed to not redefine the classes.
(require-extension coops)
(module cls
*
(import chicken scheme)
(use coops)
(define-class <a> ()))
(import cls)
(define a (make <a>))
;; foo v1
(module modu
*
(import chicken scheme)
(use coops)
(import cls)
(define-method (foo (a <a>))
(print "foo v1 on " a)))
(import modu)
(foo a)
;; foo v2
(module modu
*
(import chicken scheme)
(use coops)
(import cls)
(define-method (foo (a <a>))
(print "foo v2 on " a)))
(foo a)
;; Output:
;; foo v1 on #<coops instance of `<a>'>
;; foo v2 on #<coops instance of `<a>'>
--
Ticket URL: <http://bugs.call-cc.org/ticket/846#comment:1>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.