Towards source information in evaluated code

NoĆ© Lopez via "Developers list for Guile, the GNU extensibility library" <[email protected]> Tue, 14 Apr 2026 21:11:16 +0200
Newsgroups gmane.lisp.guile.devel
Message-ID <[email protected]>
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi everyone,

I got myself in a bit of a rabbit hole tonight, I wanted to figure out
how to have evaluated code give good backtraces.

So I started digging in (ice-9 eval), and I saw no debug information
coming from `memoize-expression'.

So I started digging in memoize.c, and I saw no debug information, and I
didn=E2=80=99t understand too much, and gdb was having a hard time with the
structs.

So I started digging the git log, and I saw this:

Andy Wingo, 2009 b7742c6b7132544b9d6cd9cb32c09e2084ad9e52
* libguile/memoize.c: New memoizer, which runs before evaluation,
  checking all syntax before evaluation begins. Significantly, no
  debugging information is left for lexical variables, which is not so
  great for interactive debugging; perhaps we should change this to have
  a var list in the future as per the classic interpreters. But it's
  quite fast, and the resulting code is quite good. Also note that it
  doesn't produce ilocs, memoized code is a smob whose type is in the
  first word of the smob itself.

The same commit mentions that it was made as part of the C-based
evaluator that was supposed to be only used for bootstrapping, but it
turns out that our scheme-based evaluator uses the same memoization.

So, what to do? I wasn=E2=80=99t there when it happened, and I=E2=80=99m pr=
obably
missing a lot of historical information. What was the plan?

Should it be that a new memoization is made in scheme to go with the
scheme evaluator, or that the existing memoization is adapted to keep
debug information?

Or am I completely off the mark?

Thanks,
No=C3=A9

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQHGBAEBCAAwFiEEXVTPJVeyOOiNwYCiLSIyQQq3QEMFAmnekVUSHG5vZUB4bi0t
bm8tY2phLmV1AAoJEC0iMkEKt0BDnpML/RQmCzi8qX5a8Ss0EvX0roxihrSjZwwn
QEDUQ7NQys+EhJ9Vo/GziQuBX7piHBv7G/q+dlLr7pMBNyC+axYdAdebAxPkIeVj
IF12U9uiSxMJfpmgIDf7G97ctJx7BH6puwH1LLWDetoh2Z21rVCVkLpE02G4pgvD
b6jgthdyRXY81toOEHjOYgHYoO53KDBJaDTiUz7gRJz78FN4Nsm8/Axh0mLVACGb
gSWujXzJfq2FK7rID3oWNcYmVhTyr5JO/0VjbwklVVGk5YFJ8G6ESipy/Xyu+J4r
6q4WjdSNrWxAHAlgagW2XDMdcHzVtzxWvmX6kjAtAGkDiyLelkLMTqbRAxPyCcbX
aeRToXc/HzXIlCgnNq3hJNEwNTOl0dgIiui9w3sqoESlxzSDvHIGXasXZMgtS7Fq
8CUNbZ0s4lSLHglxHOxNNIvIUoYonq229DVZB298Am+yEKBycX1swrjfP1AF3tCC
HoUcj/JTUHePQ9ubUuLxo8lkzqigoLPINQ==
=C//J
-----END PGP SIGNATURE-----
--=-=-=--