Control of record printing #214
Labels
No labels
Batteries
Cleanup
Consent Docket
Environments
Foundations
Macrological Fascicle
Meta
Multiple proposals exist
Pie-in-the-sky ideas
Problems without solutions
Public Comment
Publications
Question
R6RS Compatibility
Resolution in draft
Specification exists
SRFI/RnRS spec exists
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: scheme/r7rs#214
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is, to my knowledge, the only non-R6RS record system feature for which the existing N is even remotely reasonable. In fact, it easily beats 3: Chez (albeit in a section marked ‘legacy’), Chicken, Guile, MIT Scheme, Vicare. (Chibi also seems to support something like this, but it’s undocumented.)
Of these models, Vicare and Chez are likely the closest to being the best to follow if we do adopt this, since they handle recursive structure correctly.
Without readtables, this is purely a debugging feature. But it is useful for implementing data structures, because consumers do not really want to see either the internal structure, nor (if you make the type opaque) an uninformative
#<something>
which tells them nothing about what’s in it, but a list of the items/associations/whatever in the structure. (And if someone is reimplementingread
themselves they can of course add the ability to read back in whatever types they like.)I would love to see this standardized. Even without recursion, it is helpful for debugging.
MIT Scheme has a standard way of including identifying numbers in the printing of an object, even without custom printing. Those identifying numbers are put into a weak hash table associated with the REPL, and stay around for long enough that they can be referred to for a while later, but don't cause too much garbage to accumulate. So if an object is printed like this:
#[unit-test 13 (annual-event->absolute-date)]
it can later be referred to like this:
#@13
.Even if that isn't standardized, it would be great if whatever record-printing mechanism we choose could accommodate such a mechanism.