unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Maxime Devos <maximedevos@telenet.be>
Cc: Andrew Tropin <andrew@trop.in>,
	 "guile-devel@gnu.org" <guile-devel@gnu.org>
Subject: Re: [BUG] Eval sets incorrect runtime metainformation
Date: Wed, 26 Jun 2024 18:04:40 +0200	[thread overview]
Message-ID: <87frsz7krr.fsf@pobox.com> (raw)
In-Reply-To: <20240626113611.g9cB2C0023K6y2F069cBEe@michel.telenet-ops.be> (Maxime Devos's message of "Wed, 26 Jun 2024 11:36:11 +0200")

On Wed 26 Jun 2024 11:36, Maxime Devos <maximedevos@telenet.be> writes:

> IIRC, the question wasn’t about debugging in general, it was about
> source locations in particular. Surely program-sources (or, in this
> case, procedure-source maybe?) (why are the procedures in this family
> even named program-whatever, this prevents doing the same for
> interpreted code later) could be adjusted to also work for ‘eval’. For
> example, ‘eval’ could set the ‘source’ (*) procedure property when a
> closure is made.

I think it's really valuable to imagine how things should be but if you
are going to argue they should be different, you should first try to
understand how they are.

`program-sources` is a mapping from bytecode offsets to source
locations.  For compiled procedures we can make this mapping because
each bytecode position has a single source.  For interpreted procedures,
what you end up getting is the bytecode-to-source mapping *for eval*,
not for the code being interpreted.

Is it a great thing that there is a debugging (I use the term on purpose
to mean all kinds of run-time reflection etc) difference between eval
and compile?  No, of course not.  I would rather there not be a
difference and not have to document something that is at best
extraneous.  There are differing pressures on eval: for bootstrap times
(and macro expansion time) you want it to have the least amount of
overhead possible, whereas for debugging you want to attach meta-data
that isn't strictly needed at run-time.  Attaching that meta-data has
memory and time overheads.

If we are looking to get the source location *just of the interpreted
closure* -- that is possible; see eval.scm:581, there you would attach
some other properties.  You would have to define a different debugging
interface that looks for source location information in a way different
from program-sources.  For me it's not worth it but I encourage you to
experiment with (ice-9 eval); it's just another Scheme program.  (You
would need to take a different approach to memoization, in order to pass
through source location information.)

Andy



  parent reply	other threads:[~2024-06-26 16:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 15:07 [BUG] Eval sets incorrect runtime metainformation Andrew Tropin
2024-06-26  9:24 ` Andy Wingo
2024-06-26  9:36   ` Maxime Devos
2024-06-26 11:41     ` Andrew Tropin
2024-06-26 22:06       ` Philip McGrath
2024-06-28 13:20         ` Andrew Tropin
2024-06-29 19:55           ` Philip McGrath
2024-06-29 23:05         ` Maxime Devos
2024-06-30 22:27           ` Philip McGrath
2024-07-01  9:06             ` Maxime Devos
2024-07-06 16:42             ` Rob Browning
2024-07-06 18:56             ` Matt Wette
2024-06-26 16:04     ` Andy Wingo [this message]
2024-06-28 13:27       ` Andrew Tropin

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/guile/

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

  git send-email \
    --in-reply-to=87frsz7krr.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=andrew@trop.in \
    --cc=guile-devel@gnu.org \
    --cc=maximedevos@telenet.be \
    /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.
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).