unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: npostavs@users.sourceforge.net
Cc: 25295@debbugs.gnu.org
Subject: bug#25295: Acknowledgement (26.0.50; Represent eieio objects using object-print in backtraces and edebug)
Date: Sat, 31 Dec 2016 10:56:44 -0800	[thread overview]
Message-ID: <87d1g8apw3.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87y3yw7inw.fsf@users.sourceforge.net> (npostavs's message of "Sat, 31 Dec 2016 00:48:51 -0500")


On 12/31/16 00:48 AM, npostavs@users.sourceforge.net wrote:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:

[...]

>> I don't see how we could hijack at the lisp level, though. Functions
>> like `eval-expression' and `backtrace--print-frame' simply toss whole
>> lisp structures to prin1, there's no way to know that there's an eieio
>> object somewhere in that structure.
>>
>
> I think the only way to integrate `object-print' with the existing
> `print' functions, would be to make it follow the same protocol.  That
> is, currently `object-print' is really `object-to-string', it should be
> changed (or perhaps a new function (e.g., `print-object') would be a
> better idea, so as not to break existing code too much) to accept a
> PRINTCHARFUN argument, and print to it.

The problem is that pretty much all of the printing happens at the C
level. Whole lisp structures are sent directly to C, and it's the C code
that recurses through them and decides how to print everything it finds
inside. Lisp code never gets a chance (except in a few very specific
situations).

For example: when an error is raised, `backtrace--print-frame' gets all
the contents of the error as a single argument. It simply punts that to
`prin1', and then it's done. There's no chance to pick apart that single
argument and see if there is an object inside. `eval-expression'
essentially does the same thing.

>> Personally, I'd be willing to lose the ability to customize object
>> representations with `object-print', if it meant that print_object could
>> produce a #<obj notation for eieio objects. That would mean writing a 
>> C test like INSTANCEP or what have you.
>>
>
> That's easier, of course, but a non-customized representation would be
> pretty uninformative.

Having looked at the code, I'm not too optimistic about achieving the
ideal solution. Getting eval-expression and backtraces to stop exploding
seems like enough for now.





  reply	other threads:[~2016-12-31 18:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-29 20:52 bug#25295: 26.0.50; Represent eieio objects using object-print in backtraces and edebug Eric Abrahamsen
     [not found] ` <handler.25295.B.148304476023950.ack@debbugs.gnu.org>
2016-12-29 21:50   ` bug#25295: Acknowledgement (26.0.50; Represent eieio objects using object-print in backtraces and edebug) Eric Abrahamsen
2016-12-30  3:42     ` npostavs
2016-12-30 19:14       ` Eric Abrahamsen
2016-12-31  5:48         ` npostavs
2016-12-31 18:56           ` Eric Abrahamsen [this message]
2016-12-31 19:23             ` npostavs
2016-12-31 20:52               ` Eric Abrahamsen
2016-12-30  7:51     ` Eli Zaretskii
2017-01-03 18:21     ` bug#25295: Represent eieio objects using object-print in backtraces and edebug Stefan Monnier
2017-01-04 23:40       ` Eric Abrahamsen
2017-01-05  1:51         ` Stefan Monnier
2017-01-05  2:11           ` Stefan Monnier
2017-01-05  4:37             ` Stefan Monnier
2017-01-05 15:39               ` Eli Zaretskii
2017-01-06  0:42                 ` Stefan Monnier
2017-01-06  7:50                   ` Eli Zaretskii
2017-02-21  2:56               ` npostavs
2017-02-21 17:23                 ` Stefan Monnier
2017-02-22 16:15                   ` Richard Stallman
2017-02-22 19:08                     ` Stefan Monnier
2017-03-02  7:00 ` bug#25295: 26.0.50; " Stefan Monnier
2017-03-02 12:52   ` npostavs
2017-03-02 13:38     ` Stefan Monnier
2017-03-11  5:43       ` npostavs
2017-03-02 17:35   ` Eric Abrahamsen
2017-03-02 18:31     ` Stefan Monnier
2017-10-21 21:36   ` Eric Abrahamsen
2017-10-22  3:21     ` Stefan Monnier
2018-10-18 19:01       ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d1g8apw3.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=25295@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).