emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Circular records: how do I best handle them? (The new correct warning p


From: Alan Mackenzie
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

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 via email to

[Prev in Thread] Current Thread [Next in Thread]