From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#25295: Represent eieio objects using object-print in backtraces and edebug Date: Tue, 03 Jan 2017 13:21:30 -0500 Message-ID: References: <87pokampa4.fsf@ericabrahamsen.net> <8760m2mmlq.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1483467741 12307 195.159.176.226 (3 Jan 2017 18:22:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 3 Jan 2017 18:22:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cc: 25295@debbugs.gnu.org To: Eric Abrahamsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 03 19:22:17 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOTis-00025i-Fp for geb-bug-gnu-emacs@m.gmane.org; Tue, 03 Jan 2017 19:22:10 +0100 Original-Received: from localhost ([::1]:35355 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOTiw-00024y-Kk for geb-bug-gnu-emacs@m.gmane.org; Tue, 03 Jan 2017 13:22:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOTio-00023Y-Ls for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2017 13:22:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOTik-00089e-Jt for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2017 13:22:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53389) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cOTik-00089a-Gk for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2017 13:22:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cOTik-0006IX-8K for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2017 13:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Jan 2017 18:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25295 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25295-submit@debbugs.gnu.org id=B25295.148346769924179 (code B ref 25295); Tue, 03 Jan 2017 18:22:02 +0000 Original-Received: (at 25295) by debbugs.gnu.org; 3 Jan 2017 18:21:39 +0000 Original-Received: from localhost ([127.0.0.1]:40555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOTiN-0006Hv-CS for submit@debbugs.gnu.org; Tue, 03 Jan 2017 13:21:39 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:30533) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOTiL-0006Hi-89 for 25295@debbugs.gnu.org; Tue, 03 Jan 2017 13:21:38 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AdKQAu3EVY/+UVNJ1dGgEBAQECAQEBAQgBAQEBgzgBAQEBAR+EW4VUnAImAZZehhwEAgKCEUQQAQIBAQEBAQEBYiiEaAEBAQECAVYjBQsLNBIUGA0kiHoIrRSLRAEBAQEGAgEkixmKKQWPfIpqmxqGOpIPNiB4Ew6DXBwYgWMgiS0BAQE X-IPAS-Result: A0AdKQAu3EVY/+UVNJ1dGgEBAQECAQEBAQgBAQEBgzgBAQEBAR+EW4VUnAImAZZehhwEAgKCEUQQAQIBAQEBAQEBYiiEaAEBAQECAVYjBQsLNBIUGA0kiHoIrRSLRAEBAQEGAgEkixmKKQWPfIpqmxqGOpIPNiB4Ew6DXBwYgWMgiS0BAQE X-IronPort-AV: E=Sophos;i="5.33,749,1477972800"; d="scan'208";a="285266613" Original-Received: from 157-52-21-229.cpe.teksavvy.com (HELO pastel.home) ([157.52.21.229]) by smtp.teksavvy.com with ESMTP; 03 Jan 2017 13:21:31 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id ED07D653BC; Tue, 3 Jan 2017 13:21:30 -0500 (EST) In-Reply-To: <8760m2mmlq.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Thu, 29 Dec 2016 13:50:09 -0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:127709 Archived-At: > I guess this would require going into print.c and adding another branch > under the Lisp_Vectorlike case statement of object_print. That's right. > Is this sort of C code allowed to call back up to the lisp object-print > function? This is where I get lost... The Elisp-level printer and the interaction between the C code and the Elisp ill have to be worked out, indeed. E.g. you probably won't want to have Elisp-level printer to just call `format` or `prin1` since that does more than just print (it sets up a printing destination, initializes the cycle-detection table, then checks for cycles, ...). This said, making `prin1` reentrant will probably be helpful. One more thing: there have already been other desires/needs to tweak the printing from Elisp. E.g. to special case printing of objects that can't be printed readably (e.g. buffers, markers, overlays, ...). Stefan PS: One more thing; currently cl-structs and EIEIO objects are represented as plain normal arrays (and they mostly use the same representation now, where the first field contains a symbol whose function cell contains `:quick-object-witness-check` and whose value cell is the actual class object, which is a cl-struct that inherits from cl--class). It'd be good to instead provide a new kind of array just for objects/records/structs (just like we have the `compiled-function` type which is basically a normal array just with a different tag). This would let us get rid of the "symbol with a :quick-object-witness-check" indirection and would make it easier for the print.c code to delegate to the Elisp-level printer since it wouldn't need to know about the hackish representation choices of EIEIO and cl-structs.