vile / scheme / testdata / frontends / inherited-print.scm
14 lines · 14 sloc · 564 bytes · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw
1(import (scheme base) (scheme write) (vile goops))
2(define-class label () (mark #:allocation #:class #:init-value "N"))
3(define-class printed-label (label))
4(define parent (make label))
5(define child (make printed-label))
6(define first (slot-ref child 'mark))
7(slot-set! printed-label 'print
8 (lambda (item port) (display (slot-ref item 'mark) port)))
9(define port (open-output-string))
10(slot-set! parent 'mark "S")
11(write child port)
12(class-slot-set! printed-label 'mark "T")
13(write child port)
14(list first (class-slot-ref label 'mark) (get-output-string port))
15