(define my-class% (class* object% (printable<%>) (super-new)
(define/public (custom-display out) (displayln "custom-display")) (define/public (custom-write out) (writeln "custom-write")) (define/public (custom-print out depth) (print "custom-print\n" out))))
>(define obj (new my-class%))>(display obj)
custom-displaycustom-display
> (write obj)custom-display"custom-write"
> (print obj)custom-displaycustom-display"custom-print\n"
I’m not sure why it’s like that, but I know what’s the problem and how to fix it.
custom-display
and custom-write
provide the output port to you. You are supposed to write to the port.
(define/public (custom-display out)
(displayln "custom-display" out))
(define/public (custom-write out)
(writeln "custom-write" out))
--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/213fb232-d7fe-49f9-90d3-981c8662a0c5%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to racket...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/12cd77d3-76e5-4e6a-a81f-6bb61071e628%40googlegroups.com.