GNU bug report logs -
#76573
30.1; native compilation fails for record inside function
Previous Next
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 #26 received at 76573 <at> debbugs.gnu.org (full text, mbox):
> From: Lin Jian <me <at> linj.tech>
> Cc: 76573 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
> Date: Sat, 26 Apr 2025 05:13:14 +0800
>
> Andrea Corallo <acorallo <at> gnu.org> writes:
>
> > > If using `record' directly is a user error, I would suggest:
> > > 1. mentioning it in the manual
> > We can always improve the manual (patches welcome)
>
> It may not be a good idea for me to write such as patch since I do not
> know the inner workings of this topic.
>
> > the docstring for 'record' already says:
> >
> > "(record TYPE &rest SLOTS)
> >
> > Create a new record.
> > TYPE is its type as returned by ‘type-of’."
> >
> > How can somebody expect this machinery to work reliably for a certain
> > type which was never defined?
>
> Since "M-x eval-expression (type-of (record 'foo-r)) RET" works and how
> to define a type is not mentioned, users may not realize that they need
> to define a type first or they may think `record' will define the type
> for them when necessary.
Let's take a step back and revisit the original report:
> emacs -Q --batch --eval="(native-compile (defun foo-f () (record 'foo-r)))"
Error: error (foo-f "Type foo-r missing from typeof-types!")
signal(error (foo-f "Type foo-r missing from typeof-types!"))
comp--native-compile(foo-f nil nil)
native-compile(foo-f)
eval((native-compile (defun foo-f nil (record 'foo-r))) t)
command-line-1(("--eval=(native-compile (defun foo-f () (record 'foo-r)))"))
command-line()
normal-top-level()
peculiar error: "Type foo-r missing from typeof-types!"
The discussion that followed indicates that the compiler's error
message is accurate: the code attempts to use an undefined data type.
Thus, it sounds to me that Emacs is working as intended, and we should
close this non-bug.
I don't understand how you reach the conclusion that users might think
'record' creates a type, when the compiler says the type is undefined.
Maybe we should make the error message more clear, like
Type foo-r is unknown or undefined!
Will this be an okay solution?
This bug report was last modified 3 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.