[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `unreadablep'
From: |
Ihor Radchenko |
Subject: |
Re: `unreadablep' |
Date: |
Wed, 15 Dec 2021 19:39:10 +0800 |
Po Lu <luangruo@yahoo.com> writes:
>> Do you imply that `print-unreadable-function' should return the new
>> value to be printed? If so, it is indeed more flexible. Passing the
>> unreadable value to the function would also be useful (e.g. we can print
>> buffer file name instead of buffer object).
>
> It would accept a function that is called to print characters, like the
> `printcharfun' argument to prin1.
I was confused by the name. `printcharfun' in prin1 can be a buffer, a
marker, etc. Doing the same for the `print-unreadable-function' makes it
tricky to implement. How does `print-unreadable-function' print into a
buffer or marker? It would be cumbersome to consider all such cases if
the user simply wants to print nil in place of unreadable objects.
If the `printcharfun' passed to `print-unreadable-function' is strictly
an ordinary function that does actual printing, I can see a problem with
circular objects. Consider something like
(#1=a #<unreadable> #2=b #1 #1 #2).
If the main print loop is not aware of what was printed by
`print-unreadable-function' and the function tries to print reference to
b, we may get incorrect object:
(#1=a b #2=b #1 #1 #2)
The object printed instead of unreadable value will break circular
structure.
Of course, the described problem will depend on the details of
implementation.
Best,
Ihor
- RE: [External] : Re: `unreadablep', (continued)
- Re: `unreadablep', Ihor Radchenko, 2021/12/15
- Re: `unreadablep', Po Lu, 2021/12/15
- Re: `unreadablep', Ihor Radchenko, 2021/12/15
- Re: `unreadablep', Ihor Radchenko, 2021/12/15
- Re: `unreadablep', Po Lu, 2021/12/15
- Re: `unreadablep', Ihor Radchenko, 2021/12/15
- Re: `unreadablep', Po Lu, 2021/12/15
- Re: `unreadablep', Ihor Radchenko, 2021/12/15
- Re: `unreadablep', Po Lu, 2021/12/15
- Re: `unreadablep',
Ihor Radchenko <=
Re: `unreadablep', Stefan Monnier, 2021/12/15
Re: `unreadablep', Steingold, 2021/12/15
Re: `unreadablep', Steingold, 2021/12/15
Re: `unreadablep', Philipp Stephani, 2021/12/15