vile / scheme / testdata / frontends / migration.scm
13 lines · 13 sloc · 593 bytes · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw
1(import (scheme base) (vile goops))
2(define-class account () (balance #:init-value 17))
3(define-class account-method (<method>) balance)
4(define current (make account))
5(define retained current)
6(change-class current account-method)
7(slot-set! current 'specializers (list <integer>))
8(slot-set! current 'procedure (lambda (fee) (- (slot-ref retained 'balance) fee)))
9(define adjust (make-generic))
10(add-method! adjust current)
11(define copied (shallow-clone adjust))
12(list (eq? current retained) (is-a? current <method>) (copied 3)
13 (eq? retained (car (generic-function-methods copied))))
14