feat(printer): reader-macro sugar in Pr_data#124
Merged
Conversation
Pr_data now prints reader-macro expansions with their sugar instead of the underlying call: (quote x)->'x, (quasiquote x)->`x, (unquote x)->~x, (splice-unquote x)->~@x, (deref x)->@x, and (with-meta form meta)-> ^meta form. Width-aware wrapping still applies (a long '[...] wraps with the form aligned under the prefix), and the forms round-trip: the reader re-expands the sugar to the same value. This makes .state files (which serialize via Pr_data) read naturally. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pr_data(the state-file serializer) now prints reader-macro expansions with their sugar instead of the underlying call:(quote x)'x(quasiquote x)`x(unquote x)~x(splice-unquote x)~@x(deref x)@x(with-meta form meta)^meta formWidth-aware wrapping still applies (a long
'[...]wraps with the form aligned under the prefix), and the forms round-trip: the reader re-expands the sugar to the same value. Makes.state/files read naturally.Test plan
TestPrDataReaderMacroSugar(all six macros + ordinary lists untouched + round-trip); updated the two existing Pr_data layout tests to the sugared output (one now exercises a'[...]that wraps).-tags debugger.(quote …)/(deref …)forms serializes to'…/@…in.state/db.lispand loads back correctly.🤖 Generated with Claude Code