The printer tries to produce an expression that you could copy, paste, and
evaluate. Transparent structs aren't quotable but do support
constructor-style printing, so the printer uses constructor-style printing
for values that contain transparent structs. (Apparently you can configure
this in DrRacket to use e.g. quasiquotation if you prefer:
https://docs.racket-lang.org/drracket/output-syntax.html) Since opaque
structs don't support any nice printing behavior by default, the printer
gives up and uses the more concise quoted form with the non-expression
printed form of the opaque value.

The docs for prop:custom-print-quotable and gen:custom-write and the
Reference section on The Printer
<https://docs.racket-lang.org/reference/printing.html> have more technical
details.

On Tue, May 16, 2017 at 9:21 AM, Dan Grossman <d...@cs.washington.edu> wrote:

>
> Hi all,
>
> In my course here on campus, I have students use #lang racket and we put
> #:transparent on our struct definitions for easier REPL interactions.  A
> student was confused by the different printer-behavior between a and b in
> the attached screenshot, and I can't think of a reason for the different
> behavior for b compared to a and c either.  Curious if there /is/ a decent
> reason or if this is just one of those glitches.
>
> "No big deal" but worth asking...
>
> [image: Inline image 1]
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to