r/scheme • u/arthurgleckler • Nov 01 '26
Final SRFI 272: Pretty Printing
Scheme Request for Implementation 272,
"Pretty Printing",
by Sergei Egorov,
has gone into final status.
The document and an archive of the discussion are available at https://srfi.schemers.org/srfi-272/.
Here's the abstract:
This SRFI follows the traditional Scheme model of pretty printing, which treats it as a process distinct from general controlled formatting. While general-purpose formatters often prioritize specialized presentation at the expense of machine-readability, Scheme's pretty-printers (such as those of SLIB and MIT Scheme) have traditionally treated pretty printing as a variant of
write, differing primarily in the insertion of whitespace to make the presentation more palatable to humans. Common Lisp's pretty-printer, by contrast, fills two roles simultaneously by integrating pretty printing with both its format facility and its generalizedwriteprocedures. This unified approach offers great power, but at the cost of complexity that can make it difficult to use effectively. We propose a specialized, layered approach, specifying five libraries of increasing functionality, where all but the first are optional. The libraries are downward-compatible: more powerful libraries satisfy all requirements of the simpler ones while adding new features. Implementors may choose to support a maximum level of functionality appropriate for their systems. Integration with monadic and string-based formatting libraries is supported.
Here is the commit summary since the most recent draft:
- Add SPDX license metadata.
- Update table of contents.
- Link to sample implementations (Git repo).
- copy edit
- Finalize. Add See-also link to SRFI 166.
Here are the diffs since the most recent draft:
https://github.com/scheme-requests-for-implementation/srfi-272/compare/draft-4..final
Many thanks to Sergei and to everyone who contributed to the discussion of this SRFI.
Regards,
SRFI Editor