From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#25295: Represent eieio objects using object-print in backtraces and edebug Date: Wed, 04 Jan 2017 15:40:24 -0800 Message-ID: <87lguq5r87.fsf@ericabrahamsen.net> 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 1483573281 32637 195.159.176.226 (4 Jan 2017 23:41:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 4 Jan 2017 23:41:21 +0000 (UTC) User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/26.0.50 (gnu/linux) Cc: 25295@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 05 00:41:15 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 1cOvB7-0007B6-LI for geb-bug-gnu-emacs@m.gmane.org; Thu, 05 Jan 2017 00:41:09 +0100 Original-Received: from localhost ([::1]:42845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOvBB-0005ja-Jj for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 Jan 2017 18:41:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOvB5-0005jK-8Z for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2017 18:41:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOvB0-0008Vx-AH for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2017 18:41:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54417) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cOvB0-0008Vt-4r for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2017 18:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cOvAz-0005dc-L9 for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2017 18:41:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Jan 2017 23:41:01 +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.148357322921625 (code B ref 25295); Wed, 04 Jan 2017 23:41:01 +0000 Original-Received: (at 25295) by debbugs.gnu.org; 4 Jan 2017 23:40:29 +0000 Original-Received: from localhost ([127.0.0.1]:41583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOvAT-0005cj-Ct for submit@debbugs.gnu.org; Wed, 04 Jan 2017 18:40:29 -0500 Original-Received: from mail.ericabrahamsen.net ([50.56.99.223]:41813) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOvAQ-0005ca-QI for 25295@debbugs.gnu.org; Wed, 04 Jan 2017 18:40:27 -0500 Original-Received: from localhost (71-212-13-2.tukw.qwest.net [71.212.13.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id CB0A2BE9FD; Wed, 4 Jan 2017 23:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1483573226; bh=Z0LIJFhDJdjAYlXZN2YQRef/CJvVJIoQpNw4WQmtyRk=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=jOQe3YTlKRpidQ0fSopkmpwZmUtFb75N7R8qLXNHs5drbet9IGpOTmrdRusX60FPS btCPO7a9Tgd5MwFaKfIZ25V9G8hxCglx42yOxcMbieUTGu1e+Uen7oGASSfTdy/Z43 AzAgOHWqLXnDeRCrVVfHSxPCHnQr/DiiHLut0DLc= In-Reply-To: (Stefan Monnier's message of "Tue, 03 Jan 2017 13:21:30 -0500") 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:127764 Archived-At: On 01/03/17 13:21 PM, Stefan Monnier wrote: >> 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. If an Elisp-level printer is available to users and developers, I think we'd have to assume they will throw any old thing in there, including `format' and `prin1'. Would making `prin1' reentrant solve all of the resulting problems? > 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, ...). That's good! But the previous issue would still need to be resolved. > > 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. I really wish I could help, but I've never written a line of C, and in twenty minutes of looking through the sources earlier today, I couldn't even find where the array types were defined. It sounds like this would be Step One of solving the problem, but I would not be able to do it without some substantial hand-holding.