all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: Circular records: how do I best handle them?  (The new correct warning position branch now bootstraps in native compilation!)
Date: Thu, 23 Dec 2021 21:15:16 +0000	[thread overview]
Message-ID: <YcTm5GkEuaoU/Zet@ACM> (raw)

Hello, Emacs.

Firstly, the scratch/correct-warning-pos git branch (which is to deliver
the correct source code position in byte compilation warning messages)
bootstrapped with native compilation for the first time yesterday
evening.  Basically, it is now working.  :-)

However, several files.el failed to compile due to infinite recursion.
A bit of gdb'ing in Ffuncall showed that whilst compiling ffap.el (at
least), there were circular record structures (where @dfn{records} are a
pseudovector type very like normal vectors, but with their zeroth
element supposedly representing their type with a symbol).

The recursion was in the (new) function `byte-compile-strip-s-p-1'
(where "strip-s-p" stands for "strip-symbol-positions").  This function
recursively descends list and vector structures, stripping positions
from symbols-with-position it finds.

However, I seem to have circularity in a record structure, where two
records seem to point to eachother.  I suspect that it is the zeroth
elements of these records (which are meant to be symbols) that are
pointing at eachother.

Would somebody (?Stefan M, perhaps) please suggest to me how I might
efficiently cope with these circular structures.  Do I need to maintain
a list of already encountered Lisp Objects, somehow, and check this list
before recursing into the function?  It would be nice if the new
mechanism were reasonably efficient (but I don't know how important that
is).

Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).



             reply	other threads:[~2021-12-23 21:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-23 21:15 Alan Mackenzie [this message]
2021-12-24 13:56 ` Circular records: how do I best handle them? (The new correct warning position branch now bootstraps in native compilation!) Stefan Monnier
2021-12-24 20:37   ` Alan Mackenzie
2021-12-26 20:35     ` Stefan Monnier
2021-12-30 16:49       ` Alan Mackenzie
2021-12-30 18:37         ` Stefan Monnier
2021-12-31 21:53           ` Alan Mackenzie
2022-01-01 17:31             ` Stefan Monnier
2022-01-07 16:44               ` Alan Mackenzie

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

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

  git send-email \
    --in-reply-to=YcTm5GkEuaoU/Zet@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.