[plt-scheme] Problem with prop:custom-write
Hi,
Can anyone tell me what's wrong with the following code?
(define (print-internal-label lab port write?)
(let ((idx (internal-label-ref lab 1))
(sym (internal-label-ref lab 0)))
(when write? (write-string "#<label:" port))
((if write? write display) sym port)
(when idx
(write-string "-" port)
((if write? write display) idx port))
(when write? (write-string ">" port))))
(define-values
(struct:internal-label make-internal-label internal-label?
internal-label-ref internal-label-set!)
(make-struct-type 'internal-label #f 1 0 #f
(list (cons prop:custom-write
print-internal-label))))
(define internal-label-symbol (make-struct-field-accessor
struct:internal-label 0))
(define internal-label-index (make-struct-field-accessor
struct:internal-label 1))
Execution enters an infinite display loop and makes DrScheme freeze. I
want the same as (define-struct internal-label (symbol index)), but
with a customized display and write handler.
Best regards,
Erich