What is the purpose of "compact" code paths in print.c?

18 views
Skip to first unread message

Thomas Dickerson

unread,
May 28, 2020, 2:01:41 PM5/28/20
to Racket Users
I'm working on an enhancement for write/print/display, and thought I had it all implemented in io/print/main.rkt before realizing that code is only used for Racket-CS.

Now I'm working on making equivalent changes in print.c for the traditional implementation, and that code is substantially more complex.
Among other things, print has a bunch of checks against a variable called "compact", but I can't find any comments (either in the source or in the git log) as to what its for / when its used.
Can anyone comment?

Ryan Culpepper

unread,
May 28, 2020, 2:33:29 PM5/28/20
to Thomas Dickerson, Racket Users
Based on a quick look, I believe it has to do with serializing compiled code, including quoted values embedded in compiled code. Serializing compiled code uses the same entry point as the other printing functions. For example, try this:

    (write (compile '(quote (1 2 3))))

and compare the output against the contents of some .zo file.

You probably don't want to make any changes that affect the behavior when compact is true, unless you're trying to add support for a new quotable and readable data type. In that case, ask Matthew for help :)

Ryan


--
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/1a2b4d7d-bdf7-4cbb-bf9e-6565c7bfec28%40googlegroups.com.

Thomas Dickerson

unread,
May 28, 2020, 2:48:48 PM5/28/20
to ry...@racket-lang.org, Racket Users
Perfect, thanks for insight =)
Reply all
Reply to author
Forward
0 new messages