| 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 | |