GNU bug report logs - #76573
30.1; native compilation fails for record inside function

Previous Next

Package: emacs;

Reported by: Lin Jian <me <at> linj.tech>

Date: Tue, 25 Feb 2025 23:29:02 UTC

Severity: normal

Found in version 30.1

Done: Andrea Corallo <acorallo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #41 received at 76573 <at> debbugs.gnu.org (full text, mbox):

From: AKIYAMA Kouhei <misohena <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: acorallo <at> gnu.org, 76573 <at> debbugs.gnu.org, Lin Jian <me <at> linj.tech>
Subject: Re: bug#76573: 30.1;
 native compilation fails for record inside function
Date: Sun, 27 Apr 2025 19:12:23 +0900
[Message part 1 (text/plain, inline)]
Hello,

I am the author of el-easydraw, mentioned here as misohena.

I'm confused by this issue (errors during native compilation) because
I simply used the Record type as described in the Emacs Lisp manual. I
only used the `record' function, but neither the manual nor the
docstring mentions that the symbol specified as the first TYPE
argument needs to be pre-defined. The manual does mention avoiding
type name conflicts, so I added a prefix.

https://www.gnu.org/software/emacs/manual/html_node/elisp/Records.html

However, after seeing Eli's next message, I tried using `make-record'
instead of the `record' function, and the error being discussed no
longer occurred.

> Eli Zaretskii <eliz <at> gnu.org> writes:
> AFAIU, valid types are either a primitive type (so you can only create
> new types by changing the C code), or you could use make-record to
> make a record whose first slot specifies the type.

I prepared the following two test files:

;;; test-1.el ---  -*- lexical-binding: t; -*-
(defun make-test-1-obj (x y)
  (record 'test-1-obj x y))

;;; test-2.el ---  -*- lexical-binding: t; -*-
(defun make-test-2-obj (x y)
  (let ((obj (make-record 'test-2-obj 2 nil)))
    (aset obj 1 x)
    (aset obj 2 y)
    obj))

When I evaluated (native-compile "test-1.el"), the error being
discussed occurred (error "test-1.el" "Type test-1-obj missing from
typeof-types!").
On the other hand, (native-compile "test-2.el") did not produce any
errors.

My question is: Does the difference between the `record' function and
`make-record' function go beyond just how initial values are
specified?  By analogy with vector and make-vector, string and
make-string, that's what I thought, but is there a clear distinction
among Emacs developers? Does `make-record' involve type definition
while `record' does not?

I would appreciate your insights on this matter.
--
# This email has been machine translated from Japanese to English.
AKIYAMA Kouhei
[Message part 2 (text/html, inline)]

This bug report was last modified 44 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.