Re: surprising [to me and students] printer behavior with #:transparent
Dan Grossman <[email protected]>
| Newsgroups | gmane.comp.lang.racket.user,gmane.lisp.scheme.plt |
|---|---|
| Message-ID | <CADruQ+hC=mxKArUYcH4prAdGNakKHDyZ2BXoh9CyqWf3MEccOw@mail.gmail.com> |
Ah, got it, makes perfect sense through that lens -- thanks! On Tue, May 16, 2017 at 9:37 AM, Philip McGrath <philip-HuI0B06iylScIzJqBAPImwC/[email protected]> wrote: > 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 <[email protected]> > 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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] >> 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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.
Capture.PNG
(image/png, 60.7 KB) - not displayed