Hi, I created a simple class to test the printable<%> interface:
(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))))

But when I try to display an object of this class, the custom-display 
function is called twice, why?
>(define obj (new my-class%))
>(display obj)
custom-display
custom-display

And When I write the object, custom-display is also called first:
> (write obj)
custom-display
"custom-write"

With print:
> (print obj)
custom-display
custom-display
"custom-print\n"


I think I must have missed something here, and I can't find anything about 
this in the documentation of printable<%>, please help.
Thanks.

-- 
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+unsubscr...@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.

Reply via email to