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.htmlHowever, 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