[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Printing and reading special objects
From: |
Stefan Monnier |
Subject: |
Printing and reading special objects |
Date: |
Sun, 12 Mar 2017 21:36:32 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
I think we should introduce two new variables:
- print-readably-function: a variable holding the function to call to
print those objects which aren't usually printable in a way that's
`read`able (e.g. those objects normally printed as #<...>).
- read-special-function: function called when encountering an unknown
# thingy.
The second makes it possible to add a kind of reader-macro feature, but
the immediate intent would be to use those two variables via let-binding
rather than via globally setting them. Together they would make it possible
to take a data-structure holding things like markers, obarrays, and
windows, print it via `princ` and then read it back via `read` (and
providing ad-hoc ways to print&read those special objects). I think the
`print-readably-function` should be fairly easy. I haven't looked at
the potential implementation difficulty of `read-special-function`.
Any taker?
Stefan
PS: The print-readably-function would also be useful without
read-special-function in a few cases. E.g. it could be used in
savehist to burp when part of the history contains unreadable data
such as markers. And it could be used in the byte-compiler to
slightly simply the printing of the bytecode where we currently do
some of it by hand in order to be able to write the "#$" special
thingy since there's no object that prints as "#$".
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Printing and reading special objects,
Stefan Monnier <=