title: gen:custom-write for Racket classes
body: <p>I am looking for the canonical way to specify custom methods to output the fields of a Racket object. In other words I'm looking for the Racket equivalent of Java's <code>toString</code> method (if it exists). </p>
  
  <p>I know that for structs one can use <code>gen:custom-write</code> to specify the <code>write-proc</code> function (<a href="https://docs.racket-lang.org/reference/Printer_Extension.html" rel="nofollow noreferrer">source</a>). Is there something similar for classes?</p>