emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `unreadablep'


From: Po Lu
Subject: Re: `unreadablep'
Date: Wed, 15 Dec 2021 20:42:03 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Right...
>
> Skimming print_object and friends, it seems like the vast majority of
> the unprintable objects are in print_vectorlike, so I guess such a
> change could be made (pretty much?) locally to that function...

Don't we also have Lisp_Misc and friends?  (But I'm not sure Lisp_Misc
is ever supposed to be printed at all, and I don't see Lisp_Misc
anywhere, so perhaps my recollection is faulty.)

> So I think doing it that way should be pretty easy to implement, and
> it's certainly general enough to be used in both of the cases I
> sketched.  But the logic would have to be such that if
> `print-unreadable-function' returns some special value, then printing
> continues as normally (to implement the "just tell me if what was
> printed is readable" case).

We could have it return nil in that case.

> And calling out to Lisp in this case may be slower than the other
> solution sketched.

Unreadable objects are in general rare in printed objects, and a funcall
followed by a test against nil will not add any significant overhead to
prin1 either, so I wouldn't be worried about that.

Let's not optimize prematurely, especially with something like prin1 :)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]