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 #47 received at 76573 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Lin Jian <me <at> linj.tech>, 76573 <at> debbugs.gnu.org
Subject: Re: bug#76573: 30.1; native compilation fails for record inside
 function
Date: Tue, 29 Apr 2025 17:45:44 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Lin Jian <me <at> linj.tech>
>> Cc: acorallo <at> gnu.org,  76573 <at> debbugs.gnu.org
>> Date: Sat, 26 Apr 2025 17:06:48 +0800
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> > > 4. It is not clear how to fix this error.
>> > Define the type, of course.
>> 
>> > > It would be even better to mention how to fix this error.
>> > Quite obviously, to fix the error, the Lisp program should define the
>> > type.
>> 
>> Sorry, I should have been more clear.  By how to fix this error, I mean
>> how to define the type.
>> 
>> Maybe it is just misohena[1] and me, but it is not clear to us how to
>> define the type.  Could you point us to the related doc?  Thanks.
>
> 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.
>
> Andrea, am I right?

In my understanding 'record' and 'make-record' are the low level
primitives to create records, but in order to _declare_ a new type to
the system the users should use 'cl-defstruct' or 'defclass'.

My idea is from the reading of the manual: "The purpose of records is to
allow programmers to create objects with new types that are not built
into Emacs. They are used as the underlying representation of
cl-defstruct and defclass instances."

In case we want to allow for compiling calls to 'record' or
'make-record' with types not declared through 'cl-defstruct' or
'defclass' we should remove the compiler error and probably make it a
warning, shouldn't be a big deal.




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.