GNU logs - #76573, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Lin Jian <me@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 25 Feb 2025 23:29:02 +0000
Resent-Message-ID: <handler.76573.B.17405261354090 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 76573 <at> debbugs.gnu.org
Cc: Andrea Corallo <acorallo@HIDDEN>
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.17405261354090
          (code B ref -1); Tue, 25 Feb 2025 23:29:02 +0000
Received: (at submit) by debbugs.gnu.org; 25 Feb 2025 23:28:55 +0000
Received: from localhost ([127.0.0.1]:49042 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tn4MB-00013t-1z
	for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 18:28:55 -0500
Received: from lists.gnu.org ([2001:470:142::17]:42026)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1tn4M8-00013Z-8L
 for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 18:28:52 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>) id 1tn4M2-00040w-Jq
 for bug-gnu-emacs@HIDDEN; Tue, 25 Feb 2025 18:28:46 -0500
Received: from mail.linj.tech ([5.255.109.209])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>)
 id 1tn4M0-0007yG-Kn; Tue, 25 Feb 2025 18:28:46 -0500
From: Lin Jian <me@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linj.tech; s=mail;
 t=1740526120; bh=a8Bhy0NqskU4XxkYJvPI7L7ch3OBikca73DfhE0FsV4=;
 h=From:To:Subject:CC:Date;
 b=JMb5MgjCITBxaE0WaQOyPvpPI8gvwX1dObFSDNvWNlmKGO7Z9u3BxtGi1usRgN4Dg
 h0ro5UxenAotAq7LLRUZor/yFJGcna60LsB7ZqzuJB0yujwxPF/3dK5AUxx+c3t4/p
 GkrU5W7XPStCLKJn2cR2uIvyBcSfWkOkMd+cEL2+7/MA/bu/jPFZ8w2zaGGW6EkagO
 HyP2iblnb/o/uV1YSel2dGLMWoE7dOoNAGMhFGozwBg8i3FYVeQL6neky6bpD59Dfl
 iwzDLkzLNTKF3uCDwWu/N4eIOdXKrFls7AatX7HYSjdnSV0q0nAEcW++n42kPEO87d
 hdPksmoXho7ZA==
Date: Wed, 26 Feb 2025 07:28:31 +0800
Message-ID: <87o6ypa9k0.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=5.255.109.209; envelope-from=me@HIDDEN;
 helo=mail.linj.tech
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)


Run the following shell command and you see the error.

> 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!"

If you set `native-comp-speed' to -1, 0 or 1, there is no error.
> emacs -Q --batch --eval="(setopt native-comp-speed 1)" --eval="(native-compile (defun foo-f () (record 'foo-r)))"

Emacs 30.0.93 and 30.1 have this bug, while Emacs 29.4 does not.

Real world elisp packages triggering this bug are emacs-aio[1] and
el-easydraw[2].

[1]: https://github.com/skeeto/emacs-aio/issues/31
[2]: https://github.com/misohena/el-easydraw/blob/f6b0f43138693b73cb65327d28bd2a4ee1b6caa7/edraw-path.el




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Lin Jian <me@HIDDEN>
Subject: bug#76573: Acknowledgement (30.1; native compilation fails for
 record inside function)
Message-ID: <handler.76573.B.17405261354090.ack <at> debbugs.gnu.org>
References: <87o6ypa9k0.fsf@HIDDEN>
X-Gnu-PR-Message: ack 76573
X-Gnu-PR-Package: emacs
Reply-To: 76573 <at> debbugs.gnu.org
Date: Tue, 25 Feb 2025 23:29:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 76573 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
76573: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76573
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 09 Mar 2025 09:34:02 +0000
Resent-Message-ID: <handler.76573.B76573.174151280017992 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lin Jian <me@HIDDEN>, acorallo@HIDDEN
Cc: 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.174151280017992
          (code B ref 76573); Sun, 09 Mar 2025 09:34:02 +0000
Received: (at 76573) by debbugs.gnu.org; 9 Mar 2025 09:33:20 +0000
Received: from localhost ([127.0.0.1]:58297 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1trD28-0004g7-8D
	for submit <at> debbugs.gnu.org; Sun, 09 Mar 2025 05:33:20 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:39470)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1trD26-0004fs-Lw
 for 76573 <at> debbugs.gnu.org; Sun, 09 Mar 2025 05:33:19 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1trD20-0002bQ-Um; Sun, 09 Mar 2025 05:33:12 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Jxm3DvyOEAcsLr7EpdtRCpTvKqbk2yfhYTY2G/5BcMA=; b=JOFq8VJOoHov
 cNI7T6odfLhJkImRtzlyrHibwYIH/2CVjFjSVx0NQLaMSXSSJ+tK5wRL1pDqI9X1K2uezb/Nw5xaO
 Y76mvb2iRVQ+Oav+58JGbmkWZPf5ePDK8i6sTo+0Xb+ah9eT1m6lBt3XgIPhgoF6BXOM7Vld/39RP
 UeVLDquBAMZxEEVjuIqgM6mLUs4zhn1F9GFItJjLGCtCzZMCLpZNiZ2QfEjeQCRyIiGMuPlPAXMs8
 qTHEGOVB6QY9eRjTeU2t+JyTPiC0G3ZKv+9nPyZHmW7BAl44Cw+ZFktboaUUg1smqBikYUXN7pTiw
 j10PwSbClVgpMchURC0nCg==;
Date: Sun, 09 Mar 2025 11:33:10 +0200
Message-Id: <86msduh7l5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87o6ypa9k0.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
References: <87o6ypa9k0.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Andrea, could you please look into this?

> Cc: Andrea Corallo <acorallo@HIDDEN>
> Date: Wed, 26 Feb 2025 07:28:31 +0800
> From:  Lin Jian via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> 
> Run the following shell command and you see the error.
> 
> > 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!"
> 
> If you set `native-comp-speed' to -1, 0 or 1, there is no error.
> > emacs -Q --batch --eval="(setopt native-comp-speed 1)" --eval="(native-compile (defun foo-f () (record 'foo-r)))"
> 
> Emacs 30.0.93 and 30.1 have this bug, while Emacs 29.4 does not.
> 
> Real world elisp packages triggering this bug are emacs-aio[1] and
> el-easydraw[2].
> 
> [1]: https://github.com/skeeto/emacs-aio/issues/31
> [2]: https://github.com/misohena/el-easydraw/blob/f6b0f43138693b73cb65327d28bd2a4ee1b6caa7/edraw-path.el
> 
> 
> 
> 




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Andrea Corallo <acorallo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 31 Mar 2025 15:07:06 +0000
Resent-Message-ID: <handler.76573.B76573.17434335878173 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lin Jian <me@HIDDEN>
Cc: 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.17434335878173
          (code B ref 76573); Mon, 31 Mar 2025 15:07:06 +0000
Received: (at 76573) by debbugs.gnu.org; 31 Mar 2025 15:06:27 +0000
Received: from localhost ([127.0.0.1]:42421 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tzGiY-00027j-Ep
	for submit <at> debbugs.gnu.org; Mon, 31 Mar 2025 11:06:26 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:38274)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <acorallo@HIDDEN>) id 1tzGiV-000275-Dj
 for 76573 <at> debbugs.gnu.org; Mon, 31 Mar 2025 11:06:24 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acorallo@HIDDEN>)
 id 1tzGiP-00046D-Fy; Mon, 31 Mar 2025 11:06:17 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=+M9cJxxoE1rMk/dJGYrGNfaGfxWQbgurPBdoPMG37tI=; b=jrBb3ryoWHihDqPbO468
 ikOffr396qppqFZBQ8fwgEYgQu0PmZlOJJQW43M3vZkPZdyRT+FHoxgf3BW8AEmA1lUrdQ/I0T5oK
 imJd3HZ9pWapmGUS0JZd3twZXFuWdLcH2bcKX+YGQd5UOIJ7ub6CZqHxBXXg75Ca4+u+IbQYb2oh8
 jqQyMsWyq3pKaGlb18wV+/ez7X6nCuSG3lF8sSxAXtGMF1BElQmxLzB/00/8PpASHXKdseu6Aufyg
 ewzYcAcPYsHf8cStQzm6rwHz6xkZps1pXOF1MplhZF/MrXsliqBfRQkJooD254Bv+At41lGj2zjtG
 WevLW/nQ5apBGA==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1tzGiL-0001BB-UF; Mon, 31 Mar 2025 11:06:15 -0400
From: Andrea Corallo <acorallo@HIDDEN>
In-Reply-To: <87o6ypa9k0.fsf@HIDDEN> (Lin Jian's message of "Wed, 26 Feb
 2025 07:28:31 +0800")
References: <87o6ypa9k0.fsf@HIDDEN>
Date: Mon, 31 Mar 2025 11:06:13 -0400
Message-ID: <yp11pudutne.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Lin Jian <me@HIDDEN> writes:

> Run the following shell command and you see the error.
>
>> 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!"
>
> If you set `native-comp-speed' to -1, 0 or 1, there is no error.
>> emacs -Q --batch --eval="(setopt native-comp-speed 1)"
>> --eval="(native-compile (defun foo-f () (record 'foo-r)))"
>
> Emacs 30.0.93 and 30.1 have this bug, while Emacs 29.4 does not.
>
> Real world elisp packages triggering this bug are emacs-aio[1] and
> el-easydraw[2].
>
> [1]: https://github.com/skeeto/emacs-aio/issues/31
> [2]: https://github.com/misohena/el-easydraw/blob/f6b0f43138693b73cb65327d28bd2a4ee1b6caa7/edraw-path.el

Hi Lin,

the compiler is complaining because while the code is trying to create
an object of type 'foo-r', this was actually never defined.

Typically those user defined objects are defined using higher level
constructs like 'cl-defstruct' which takes care of registering the
definition into the global state (and defining the creator
'make-foo-r').

Why is this code trying to create never defined kind of objects?  Isn't
the case that the code in the file being compiled is missing some
require to the definition?

  Andrea




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 13 Apr 2025 07:53:04 +0000
Resent-Message-ID: <handler.76573.B76573.174453077332737 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: me@HIDDEN, Andrea Corallo <acorallo@HIDDEN>
Cc: 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.174453077332737
          (code B ref 76573); Sun, 13 Apr 2025 07:53:04 +0000
Received: (at 76573) by debbugs.gnu.org; 13 Apr 2025 07:52:53 +0000
Received: from localhost ([127.0.0.1]:37941 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u3s95-0008Vp-OI
	for submit <at> debbugs.gnu.org; Sun, 13 Apr 2025 03:52:53 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41934)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1u3s8z-0008Tx-8W
 for 76573 <at> debbugs.gnu.org; Sun, 13 Apr 2025 03:52:48 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1u3s8t-0006Eg-0O; Sun, 13 Apr 2025 03:52:39 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Q+MR8BMq7M4zeFoP4xyLLp/jwaMH4N3ZFYem/3wdk4Q=; b=sKSnhB4hwTSU
 PN7D9IC07Hb4vyHFBUQKrk8SvObV+gb19dGDDBJawtiFGmD3EbDGJ4biJB9t8ColD7nVw2J4cD9fm
 R18fGq5iQzxQRw+AjG9NRlV9sY17AaqvNDz1a1jyAF8uF7DNsmNiAizxTw5c7Ggz2BQYZvimGUVkc
 paRVVwL2S0T1OPDaYVBPeoWxJp9RncrvXJ7wnPJVMjmQiywwAcgk7l5jlXfRqtglzXKHwTrDF77m0
 C7ZWGvvr0jdht6nHkK2rETdlywsKHGQOYfxN1B70ONWuXztYhUB3SWYvIPD0WaX1ZQ7+9SVOcgduw
 wALGqZnOcbpT+wW6SLyCHw==;
Date: Sun, 13 Apr 2025 10:52:35 +0300
Message-Id: <86friclcqk.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <yp11pudutne.fsf@HIDDEN> (message from Andrea Corallo
 on Mon, 31 Mar 2025 11:06:13 -0400)
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ping!  Lin Jian, can you please answer Andrea's questions, so we could
decide how to proceed with this issue?

> Cc: 76573 <at> debbugs.gnu.org
> From: Andrea Corallo <acorallo@HIDDEN>
> Date: Mon, 31 Mar 2025 11:06:13 -0400
> 
> Lin Jian <me@HIDDEN> writes:
> 
> > Run the following shell command and you see the error.
> >
> >> 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!"
> >
> > If you set `native-comp-speed' to -1, 0 or 1, there is no error.
> >> emacs -Q --batch --eval="(setopt native-comp-speed 1)"
> >> --eval="(native-compile (defun foo-f () (record 'foo-r)))"
> >
> > Emacs 30.0.93 and 30.1 have this bug, while Emacs 29.4 does not.
> >
> > Real world elisp packages triggering this bug are emacs-aio[1] and
> > el-easydraw[2].
> >
> > [1]: https://github.com/skeeto/emacs-aio/issues/31
> > [2]: https://github.com/misohena/el-easydraw/blob/f6b0f43138693b73cb65327d28bd2a4ee1b6caa7/edraw-path.el
> 
> Hi Lin,
> 
> the compiler is complaining because while the code is trying to create
> an object of type 'foo-r', this was actually never defined.
> 
> Typically those user defined objects are defined using higher level
> constructs like 'cl-defstruct' which takes care of registering the
> definition into the global state (and defining the creator
> 'make-foo-r').
> 
> Why is this code trying to create never defined kind of objects?  Isn't
> the case that the code in the file being compiled is missing some
> require to the definition?
> 
>   Andrea
> 
> 
> 
> 




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Lin Jian <me@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 23 Apr 2025 12:11:03 +0000
Resent-Message-ID: <handler.76573.B76573.174541023412606 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Andrea Corallo <acorallo@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.174541023412606
          (code B ref 76573); Wed, 23 Apr 2025 12:11:03 +0000
Received: (at 76573) by debbugs.gnu.org; 23 Apr 2025 12:10:34 +0000
Received: from localhost ([127.0.0.1]:55243 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u7Yvx-0003HB-9T
	for submit <at> debbugs.gnu.org; Wed, 23 Apr 2025 08:10:33 -0400
Received: from mail.linj.tech ([5.255.109.209]:40950)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1u7Yvv-0003Fi-1s
 for 76573 <at> debbugs.gnu.org; Wed, 23 Apr 2025 08:10:31 -0400
From: Lin Jian <me@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linj.tech; s=mail;
 t=1745410228; bh=8aOdre2BURKNAgpVh2zEY9gt9nWhPPIlfIaFbIsKYls=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=LeXkgCuW6Gn0MitL666pdAawPy3Z6KTE74YwL0ZJ3bpVcnkzEVZq7Vz3lF6rNvsQV
 ytRRIEvscU+X4ZTVInRsxMY+uLthP0jdmFOdEzqOeO1DQ0pxIvcJNtNp7VhQN76jDp
 TbbM2716CJGOIZ6NBJzFfhoCo//ak2jKHUZGQLw6CNOH/mHt5G+SWeombTdLY6l0pr
 SfaDHYAYsTRYeNNTrgCYc++Pv13EnmXzKXhoegxpNaKsROjsT8MbziXPrJyBcdlJyT
 ABIn9WfiT3wTpEH6LssuX6uX6i8+NKwV6AyceB1jU05Av6ZtQM96tY1fedSMAmUl9A
 cRj1H1eOtBiXA==
In-Reply-To: <yp11pudutne.fsf@HIDDEN> (Andrea Corallo's message of
 "Mon, 31 Mar 2025 11:06:13 -0400")
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
Date: Wed, 23 Apr 2025 20:10:11 +0800
Message-ID: <874iyfoz8c.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Sorry for the late reply.

Andrea Corallo <acorallo@HIDDEN> writes:

> the compiler is complaining because while the code is trying to create
> an object of type 'foo-r', this was actually never defined.
>
> Typically those user defined objects are defined using higher level
> constructs like 'cl-defstruct' which takes care of registering the
> definition into the global state (and defining the creator
> 'make-foo-r').
>
> Why is this code trying to create never defined kind of objects?  Isn't
> the case that the code in the file being compiled is missing some
> require to the definition?

I have no idea why some elisp packages use `record' directly instead of
some higher level functions like `cl-defstruct' since I am not the
author of those packages.

If using `record' directly is a user error, I would suggest:
1. mentioning it in the manual
2. and maybe also making the behavior consistent across different
`native-comp-speed' values.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Andrea Corallo <acorallo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 25 Apr 2025 20:48:01 +0000
Resent-Message-ID: <handler.76573.B76573.174561404229893 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lin Jian <me@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.174561404229893
          (code B ref 76573); Fri, 25 Apr 2025 20:48:01 +0000
Received: (at 76573) by debbugs.gnu.org; 25 Apr 2025 20:47:22 +0000
Received: from localhost ([127.0.0.1]:53830 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u8Px9-0007lh-Rl
	for submit <at> debbugs.gnu.org; Fri, 25 Apr 2025 16:47:21 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49194)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <acorallo@HIDDEN>) id 1u8Px6-0007kM-3M
 for 76573 <at> debbugs.gnu.org; Fri, 25 Apr 2025 16:47:18 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acorallo@HIDDEN>)
 id 1u8Px0-00006i-6r; Fri, 25 Apr 2025 16:47:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=+FffpOV6M1zC9zHxK1BfxVTXhTEM8XAeyCDnHoO1Avk=; b=ao0Mt+XA2KIlRnM2GuZn
 eL8JOZ8KWWA+kl9NSrwsTY1CKpOo5LwGgMrNM6dVU7SzreKHZMV4Tfq87m33iiaOGsSy0nuInlnq6
 7ReqcMgd/oCXvCp/KH9uV1CeQ8QZaN8zM53l8DWm8U9/Rfx19nG74qL4V0hjpp8gdoyMoQvOP04vN
 VMGIxPC3F8jm44feR0VHPE19EDF4vTBl1xNcKqOITdjt8ObbjLXbab6SbcDRd4qaIreSFV7dksYza
 OL0523kfZ7uhvpPR2Q5MLVIFnbUUJNcVQJtnOhGTLFaaE3aBNNOnBKs8yiETnPYg/edvJuO7ygw0w
 IzIvuwIMS6oggw==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1u8Pwz-0000o3-Iy; Fri, 25 Apr 2025 16:47:09 -0400
From: Andrea Corallo <acorallo@HIDDEN>
In-Reply-To: <874iyfoz8c.fsf@HIDDEN> (Lin Jian's message of "Wed, 23 Apr
 2025 20:10:11 +0800")
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
 <874iyfoz8c.fsf@HIDDEN>
Date: Fri, 25 Apr 2025 16:47:09 -0400
Message-ID: <yp15xist1de.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Lin Jian <me@HIDDEN> writes:

> Sorry for the late reply.
>
> Andrea Corallo <acorallo@HIDDEN> writes:
>
>> the compiler is complaining because while the code is trying to create
>> an object of type 'foo-r', this was actually never defined.
>>
>> Typically those user defined objects are defined using higher level
>> constructs like 'cl-defstruct' which takes care of registering the
>> definition into the global state (and defining the creator
>> 'make-foo-r').
>>
>> Why is this code trying to create never defined kind of objects?  Isn't
>> the case that the code in the file being compiled is missing some
>> require to the definition?
>
> I have no idea why some elisp packages use `record' directly instead of
> some higher level functions like `cl-defstruct' since I am not the
> author of those packages.
>
> 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), but the docstring
for 'record' already says:

"(record TYPE &rest SLOTS)

Create a new record.
TYPE is its type as returned by =E2=80=98type-of=E2=80=99."

How can somebody expect this machinery to work reliably for a certain
type which was never defined?




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Lin Jian <me@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 25 Apr 2025 21:14:02 +0000
Resent-Message-ID: <handler.76573.B76573.17456156125062 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Andrea Corallo <acorallo@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.17456156125062
          (code B ref 76573); Fri, 25 Apr 2025 21:14:02 +0000
Received: (at 76573) by debbugs.gnu.org; 25 Apr 2025 21:13:32 +0000
Received: from localhost ([127.0.0.1]:53977 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u8QMU-0001JR-V0
	for submit <at> debbugs.gnu.org; Fri, 25 Apr 2025 17:13:31 -0400
Received: from mail.linj.tech ([5.255.109.209]:46482)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1u8QMR-0001If-0X
 for 76573 <at> debbugs.gnu.org; Fri, 25 Apr 2025 17:13:28 -0400
From: Lin Jian <me@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linj.tech; s=mail;
 t=1745615605; bh=8HNPbl1Z/fWy7Jm1jU4A62WGkIHxQtoa2WUy4PoFDMo=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=Dcupg03JqBnOp5/bO3Tj/bpKSKkMSVMY4Ar+HmHNxDJPafCmoFN6ln8BUZNlcWXdW
 Ud5XHB9SbUrW/a7mPW1izWgJduThMnWotmQ7N8nLa/iZtJqVcmGawkEkkxwY09Ba8k
 4fnz83WGXTCZf2won4wAitdwg5DzSo1LQuhk7paCbxKj1zLcv20QphedmRF4X0USvE
 GFERp4B8aDAnHlHpCG/xQgV5qI3BtrGronzGX7nhNbop9doY2nLlfTYuFOANow6RFW
 UncYAYv32jkmQxstE1q+FJwC1NrdDG6TcMyMq3uEdHLMt0BoDUuZAlIMJ94ObN2IBj
 50w7K14sEPvkA==
In-Reply-To: <yp15xist1de.fsf@HIDDEN> (Andrea Corallo's message of
 "Fri, 25 Apr 2025 16:47:09 -0400")
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
 <874iyfoz8c.fsf@HIDDEN> <yp15xist1de.fsf@HIDDEN>
Date: Sat, 26 Apr 2025 05:13:14 +0800
Message-ID: <87v7qsndw5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Andrea Corallo <acorallo@HIDDEN> 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 =E2=80=98type-of=E2=80=99."
>
> 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.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 26 Apr 2025 06:55:02 +0000
Resent-Message-ID: <handler.76573.B76573.17456504812481 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lin Jian <me@HIDDEN>
Cc: acorallo@HIDDEN, 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.17456504812481
          (code B ref 76573); Sat, 26 Apr 2025 06:55:02 +0000
Received: (at 76573) by debbugs.gnu.org; 26 Apr 2025 06:54:41 +0000
Received: from localhost ([127.0.0.1]:57308 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u8ZQu-0000dx-LW
	for submit <at> debbugs.gnu.org; Sat, 26 Apr 2025 02:54:41 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:52416)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1u8ZQs-0000dh-3l
 for 76573 <at> debbugs.gnu.org; Sat, 26 Apr 2025 02:54:38 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1u8ZQm-0001Zb-Dt; Sat, 26 Apr 2025 02:54:32 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=Y7NmjfV4+RXGEhjS+wtcvDKLe3TggHiqU9lWuDwAows=; b=aYEXM9GfHvlUkHgT/Sdv
 Flpu0EUpSNvCsK0A7giNX13StnFKPK1kOpuV8WthqIvYYVuntUQ81aZXio2oaC9xFtdYs3KCgJx1e
 sQuWoJLWuwtLo53lCjqZa5jcsz/q6E+hr7iZjLYy4lbAKJQa3JFj+jfdtNVRHnEVjpigIzCCjqJ7z
 9YZgtPZKN7/VR5NB/YxFjyVl6wM6c3+qo0Jn5pxHWLMNxiQG95mVaPzSnEGJnJ5WoTjr7WuKnO26q
 aVa4XRXv/QhuJVdHFCKODag0DQjkfx8PsIs/qniDQLdeOPGyHS/ZEgddr9SG5Jo5sHmCJZNt2uJTn
 bK1kzW2/EbBjcA==;
Date: Sat, 26 Apr 2025 09:54:27 +0300
Message-Id: <868qnnwgyk.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87v7qsndw5.fsf@HIDDEN> (message from Lin Jian on Sat, 26 Apr
 2025 05:13:14 +0800)
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
 <874iyfoz8c.fsf@HIDDEN> <yp15xist1de.fsf@HIDDEN>
 <87v7qsndw5.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Lin Jian <me@HIDDEN>
> Cc: 76573 <at> debbugs.gnu.org,  Eli Zaretskii <eliz@HIDDEN>
> Date: Sat, 26 Apr 2025 05:13:14 +0800
> 
> Andrea Corallo <acorallo@HIDDEN> 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?




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Lin Jian <me@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 26 Apr 2025 07:51:02 +0000
Resent-Message-ID: <handler.76573.B76573.174565382016251 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: acorallo@HIDDEN, 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.174565382016251
          (code B ref 76573); Sat, 26 Apr 2025 07:51:02 +0000
Received: (at 76573) by debbugs.gnu.org; 26 Apr 2025 07:50:20 +0000
Received: from localhost ([127.0.0.1]:57539 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u8aIk-0004Df-1y
	for submit <at> debbugs.gnu.org; Sat, 26 Apr 2025 03:50:19 -0400
Received: from mail.linj.tech ([5.255.109.209]:54668)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1u8aIf-0004BA-Ut
 for 76573 <at> debbugs.gnu.org; Sat, 26 Apr 2025 03:50:14 -0400
From: Lin Jian <me@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linj.tech; s=mail;
 t=1745653812; bh=pFAcfOO1ysCV0mJLDnKcHGtFPcqIuoPB/kDWDlZbA9Q=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=EE4Y6UVotM1B8+qKVJT4R0HVPJSqHd8LfaI9pGuMlp1q3u4P774LFUogKwsEbPEtf
 zPo1i9CfgRX06qRZ0sJBadqlLA9OzJm8P2ApPMB298a+eicDKBGT+WUjJTIzzDwTQB
 x3GYgI6V+hhiJymbjPtki00IefsmuKxp5yaCq+CJusGs16UXPjQFQqxjfTGPMtw20b
 QxJ6KJs1uduW84sxfedZWVdFi8/XDU19MeuJtchL+5J+fsazF5YAgRBMEgJKK10YUl
 NKQdlhA1Q6kc2JRRxcdNXjRU5UenS7A0NX09WTaccqOu6fQyEiqjqOL1dVBIMLmVQ5
 UCYaQeT3FThIA==
In-Reply-To: <868qnnwgyk.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 26 Apr
 2025 09:54:27 +0300")
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
 <874iyfoz8c.fsf@HIDDEN> <yp15xist1de.fsf@HIDDEN>
 <87v7qsndw5.fsf@HIDDEN> <868qnnwgyk.fsf@HIDDEN>
Date: Sat, 26 Apr 2025 15:50:03 +0800
Message-ID: <87plgznyz8.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


My point is not that the code is correct and the compiler is wrong.  To
make it crystal clear, my point is that the following situation is
confusing and we should make it less so.  At least the author of
el-easydraw agrees[1] with me.

1. This compiler error only appears in Emacs >= 30.
2. This compiler error does not appear if native-comp-speed < 2.
3. It's not clear from the manual and the docstring that the code is
wrong.
4. It is not clear how to fix this error.

> Maybe we should make the error message more clear, like
>
>   Type foo-r is unknown or undefined!

It would be even better to mention how to fix this error.

[1]: https://github.com/misohena/el-easydraw/issues/36#issuecomment-2831640002




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 26 Apr 2025 08:49:01 +0000
Resent-Message-ID: <handler.76573.B76573.1745657289357 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lin Jian <me@HIDDEN>
Cc: acorallo@HIDDEN, 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.1745657289357
          (code B ref 76573); Sat, 26 Apr 2025 08:49:01 +0000
Received: (at 76573) by debbugs.gnu.org; 26 Apr 2025 08:48:09 +0000
Received: from localhost ([127.0.0.1]:57991 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u8bCi-00005e-DX
	for submit <at> debbugs.gnu.org; Sat, 26 Apr 2025 04:48:08 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:39716)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1u8bCf-00004z-4F
 for 76573 <at> debbugs.gnu.org; Sat, 26 Apr 2025 04:48:06 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1u8bCZ-0005tt-LZ; Sat, 26 Apr 2025 04:47:59 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=U7ADF9LpHFqtEGKaEV0tun/zbBkuAssBEMM6BnMyqd0=; b=p0PjEhxd5/0T
 idfmw5WlU6yDkq6HQMpxeYvQQw+4QIKW3NsfNYMmWE4Knbe1YGycY36DgsFx9wzCGhRBNvWRnj99O
 1RfS6+81zX4wUMQFThQvCA90Hl3JArFnKWvZ5VQZm1WmyjVKxlkbKxNSPGpnWYNZYzeOiR3cdS5ZE
 xP6gQwbWhDB7HLKufkgzidkPstA4wAWd1mwxJnRp64Y292HOjT8y0qe1qY29d4PCRpyTIFOkNXpa2
 Bpv0hWMVF32zH40/2/PiAIO8aO6haokDToqEhIPtcjOOzwNTLyFMJ5X/zgzWXsALRokVNlbcyeg6N
 4DOYVM0NMhyVYush2nPA1g==;
Date: Sat, 26 Apr 2025 11:47:52 +0300
Message-Id: <86v7qrux53.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87plgznyz8.fsf@HIDDEN> (message from Lin Jian on Sat, 26 Apr
 2025 15:50:03 +0800)
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
 <874iyfoz8c.fsf@HIDDEN> <yp15xist1de.fsf@HIDDEN>
 <87v7qsndw5.fsf@HIDDEN> <868qnnwgyk.fsf@HIDDEN> <87plgznyz8.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Lin Jian <me@HIDDEN>
> Cc: acorallo@HIDDEN,  76573 <at> debbugs.gnu.org
> Date: Sat, 26 Apr 2025 15:50:03 +0800
> 
> 
> My point is not that the code is correct and the compiler is wrong.  To
> make it crystal clear, my point is that the following situation is
> confusing and we should make it less so.  At least the author of
> el-easydraw agrees[1] with me.
> 
> 1. This compiler error only appears in Emacs >= 30.

I don't see this as a problem.  Emacs 31 introduces quite a few
warnings were questionable or wrong techniques are used in Lisp.

> 2. This compiler error does not appear if native-comp-speed < 2.

This is unfortunate, but not unheard of: the same happens with
compiling code with GCC, for example.

Andrea, can we somehow test this with all the values of
native-comp-speed?  Why does this pop up only with some values?

> 3. It's not clear from the manual and the docstring that the code is
> wrong.

The manual and the doc string cannot possibly describe all the cases
of wrong code.  The error message is quite clear about the problem, so
I don't see a problem here.

> 4. It is not clear how to fix this error.

Define the type, of course.

> > Maybe we should make the error message more clear, like
> >
> >   Type foo-r is unknown or undefined!
> 
> 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.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Lin Jian <me@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 26 Apr 2025 09:07:01 +0000
Resent-Message-ID: <handler.76573.B76573.17456584185019 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: acorallo@HIDDEN, 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.17456584185019
          (code B ref 76573); Sat, 26 Apr 2025 09:07:01 +0000
Received: (at 76573) by debbugs.gnu.org; 26 Apr 2025 09:06:58 +0000
Received: from localhost ([127.0.0.1]:58098 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u8bUw-0001Is-2E
	for submit <at> debbugs.gnu.org; Sat, 26 Apr 2025 05:06:58 -0400
Received: from mail.linj.tech ([5.255.109.209]:52784)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1u8bUs-0001If-Fn
 for 76573 <at> debbugs.gnu.org; Sat, 26 Apr 2025 05:06:55 -0400
From: Lin Jian <me@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linj.tech; s=mail;
 t=1745658412; bh=WSpv6uogEUm2tUErY+Ldc+NPxB7PQKqhpgeJ6/a2OlI=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=ZIFzPePPse6ZJqHZ2wZ1PkCs8mUur57Mzvb4XnGSXYGbQuC1s3Tj8DClB5A9Tl8j+
 LUG9ZrExHirDDTX9F7EDZpk+s8RxfT1L7O7m+Qc4b8Yb/tmuA096SooXdhgrmMsdvy
 JhowOsNtW8P+FLmXwXkUXCO5oqIXRIyHeEnBTtDeB7hyxDE4Cqe2CSN0GofbIWKRUe
 HEUtfhLQaQyrFBXa6ix4fkVQ9OcEgPZg7bW1w4tp1H+/YdOxGzZJByIhSITfHgOkWe
 lIMNR3vhSv8H8ZQScVDr7LzcuDoifh702DXzMgEI3l55aDqJIFEd8RQ6Ut6ghTs9ra
 BhHXcCyce2Y+Q==
In-Reply-To: <86v7qrux53.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 26 Apr
 2025 11:47:52 +0300")
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
 <874iyfoz8c.fsf@HIDDEN> <yp15xist1de.fsf@HIDDEN>
 <87v7qsndw5.fsf@HIDDEN> <868qnnwgyk.fsf@HIDDEN>
 <87plgznyz8.fsf@HIDDEN> <86v7qrux53.fsf@HIDDEN>
Date: Sat, 26 Apr 2025 17:06:48 +0800
Message-ID: <87jz77nvfb.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> 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.

[1]: https://github.com/misohena/el-easydraw/issues/36#issuecomment-2831640002




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 26 Apr 2025 10:58:01 +0000
Resent-Message-ID: <handler.76573.B76573.174566503330579 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lin Jian <me@HIDDEN>
Cc: acorallo@HIDDEN, 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.174566503330579
          (code B ref 76573); Sat, 26 Apr 2025 10:58:01 +0000
Received: (at 76573) by debbugs.gnu.org; 26 Apr 2025 10:57:13 +0000
Received: from localhost ([127.0.0.1]:58574 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u8dDd-0007x8-FX
	for submit <at> debbugs.gnu.org; Sat, 26 Apr 2025 06:57:13 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47804)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1u8dDa-0007wm-2g
 for 76573 <at> debbugs.gnu.org; Sat, 26 Apr 2025 06:57:11 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1u8dDS-00044S-8B; Sat, 26 Apr 2025 06:57:02 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=z0NE27NNWrQuBAunHK0nRVcWHtw50uPbvHhhiFOj7o4=; b=IP4HD88inQm0
 v1kZunDOwqSB/1JAV69a+Uo8NPAWjgUpeu+gD+A0nncQZ05Zg33k0ZvEfaBFTFG7DAkM3O5maIazU
 R9XcOsFaXrslc+GHkD2keGbY+U9oJLk+M4M5ZMqkt+WP7wnHnLzHNRm8jmWBvhJAfDRyxKfan1pMn
 7qjbtE0W2YgnPJbPTlGhh4sORqj5KEFrb9IJzRPIpMSYKDSpS1W6VIbcsdD/cR3bgZlGgLwvuBVDS
 lRuCsDuMzurat/1almXVjhjbq4v4WhUduqF57s328xL0aLwA1aRScSm6TCFht3pQl7xXmz6ECyZHC
 Ni9d1QXu5YYBBdKP9ug0bg==;
Date: Sat, 26 Apr 2025 13:56:59 +0300
Message-Id: <86r01fur5w.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87jz77nvfb.fsf@HIDDEN> (message from Lin Jian on Sat, 26 Apr
 2025 17:06:48 +0800)
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
 <874iyfoz8c.fsf@HIDDEN> <yp15xist1de.fsf@HIDDEN>
 <87v7qsndw5.fsf@HIDDEN> <868qnnwgyk.fsf@HIDDEN>
 <87plgznyz8.fsf@HIDDEN> <86v7qrux53.fsf@HIDDEN> <87jz77nvfb.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Lin Jian <me@HIDDEN>
> Cc: acorallo@HIDDEN,  76573 <at> debbugs.gnu.org
> Date: Sat, 26 Apr 2025 17:06:48 +0800
> 
> Eli Zaretskii <eliz@HIDDEN> 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?




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
References: <87o6ypa9k0.fsf@HIDDEN>
In-Reply-To: <87o6ypa9k0.fsf@HIDDEN>
Resent-From: AKIYAMA Kouhei <misohena@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 27 Apr 2025 11:26:02 +0000
Resent-Message-ID: <handler.76573.B76573.17457531459555 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: acorallo@HIDDEN, 76573 <at> debbugs.gnu.org, Lin Jian <me@HIDDEN>
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.17457531459555
          (code B ref 76573); Sun, 27 Apr 2025 11:26:02 +0000
Received: (at 76573) by debbugs.gnu.org; 27 Apr 2025 11:25:45 +0000
Received: from localhost ([127.0.0.1]:39714 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u908n-0002U3-76
	for submit <at> debbugs.gnu.org; Sun, 27 Apr 2025 07:25:45 -0400
Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]:55385)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <misohena@HIDDEN>)
 id 1u8z05-0006Et-IJ
 for 76573 <at> debbugs.gnu.org; Sun, 27 Apr 2025 06:12:42 -0400
Received: by mail-lj1-x232.google.com with SMTP id
 38308e7fff4ca-30bfed67e08so40133171fa.2
 for <76573 <at> debbugs.gnu.org>; Sun, 27 Apr 2025 03:12:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1745748755; x=1746353555; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=ec0JZ1wug3QccANn+BmQST0wOm5hvLhUnXVdYXydV9c=;
 b=bmkzxlyXN48w09Im7elqy/SL0e7MBPRyoVLNFf3+lzQ8urZY2t0oXLnrkO+d/qlX+b
 UPCbgdDbm5jKaPc8NjkD8oDIgBVsv5dLz6SGFsAdlJWXGQLpFckiVXeA56ly+s0bwfK0
 LFYZKY+o4ZJgW/d+3nPQyKpM4PdUWMUVvcj9oYrZPkuWVJXeO7+r8e2qctNR5SrZIztS
 wv9Rpznc6Yj6PQs6LAJMCzkj52bB+f1TfNvTCzh8hNZLthMBO5CppyYlzcGYCMESDnvd
 kcygGvw0eQJu04XGnf8WYDa9NfYdOGld/E0r6hwhzG/FMPpcD3ctfd1rw+z6+fxk2CUE
 wXHA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1745748755; x=1746353555;
 h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=ec0JZ1wug3QccANn+BmQST0wOm5hvLhUnXVdYXydV9c=;
 b=doORWx583vt+JE2V1CmnzsY7PgLZeGH23HmLGYeyG6up1qSlFc6V3SrlRFYW9wbyyM
 CRrLzrXQ3pRI05ls/EmfIVzUksedUAcOcUt09bY1e28qL34DraVjrZSrlq8nka4d5j6f
 ro9BiI+u7MY5GsX/3zb9ehF1fubUL33xKoTOheCuVaXkNIa+Te6xwNsjcPz4VMGmMzUN
 QaV6IFHaG9Uc4aleDdSFRzuWc4d3v8Hp9MNzEC3/OMuBA+RqNJs56zc3Lh2xXyCV6tY3
 SDvuJ04o6q9gTXQc19+pO9uEBkZRLpDjqBNtT1JMt87/OH3fvCAySDkM62aEbHL/glTF
 1Hbw==
X-Forwarded-Encrypted: i=1;
 AJvYcCUnmgXwXf977aRjqkduBHgBcwDA4TXXq609l/o6xDqtREbCTKdO1pfQ+DI98gyLBVfR1r4ITA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzwEeWZ8dxogZmixUROYbRXu8x5eOoP0/ALo0oXNwaTFbJ4tmkY
 0CturuLOawJiZnasTvJtPExKMAn+hTpt5qr3NEKZYTnCfVBSgbzT44sZt5fpA8mMx000VIFg+rW
 69MpfL5n5fsvmdFlMKPtWWtwvpOx1IGxuWG4=
X-Gm-Gg: ASbGncuOKcdG828bfHVkBonRG/hUXX3xPzIklXN/JA06jgI19/0e0V7ZDcnRL75dZ9Y
 VL1fDTIuhkGG7PloRJnMGAmSRv71ixKVsCI6vNpq4GuKK63/dpmJcC3AZLLzxLCm6o969Dz8kKf
 /W934d1C1eAm5haSp6o/G0Hw==
X-Google-Smtp-Source: AGHT+IF6lj/Thx8dXOHart9HOsawBNwuYNf3LNUdonYYrqWNO456pQTE0/Ctvox13O6Z9o23GxotGp39AKqQNDE+CzI=
X-Received: by 2002:a2e:9a04:0:b0:30b:ee81:9622 with SMTP id
 38308e7fff4ca-319dd795e9bmr13063651fa.31.1745748754486; Sun, 27 Apr 2025
 03:12:34 -0700 (PDT)
MIME-Version: 1.0
From: AKIYAMA Kouhei <misohena@HIDDEN>
Date: Sun, 27 Apr 2025 19:12:23 +0900
X-Gm-Features: ATxdqUGwUsW5BkeDmG4-9VYRMGToLc5UqIDvCgAxAbZmmTCGc8Dz4tKijxFnUgE
Message-ID: <CAAo_Hv8oFG4r16VPVM2Qxn6Jp-29ZXPmq3F=HZk49tOjsj0WeQ@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000060dfd20633bfce49"
X-Spam-Score: 0.0 (/)
X-Mailman-Approved-At: Sun, 27 Apr 2025 07:25:44 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000060dfd20633bfce49
Content-Type: text/plain; charset="UTF-8"

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

--00000000000060dfd20633bfce49
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<br><br>I am the author of el-easydraw, mentioned he=
re as misohena.<br><br>I&#39;m confused by this issue (errors during native=
 compilation) because<br>I simply used the Record type as described in the =
Emacs Lisp manual. I<br>only used the `record&#39; function, but neither th=
e manual nor the<br>docstring mentions that the symbol specified as the fir=
st TYPE<br>argument needs to be pre-defined. The manual does mention avoidi=
ng<br>type name conflicts, so I added a prefix.<br><br><a href=3D"https://w=
ww.gnu.org/software/emacs/manual/html_node/elisp/Records.html">https://www.=
gnu.org/software/emacs/manual/html_node/elisp/Records.html</a><br><br>Howev=
er, after seeing Eli&#39;s next message, I tried using `make-record&#39;<br=
>instead of the `record&#39; function, and the error being discussed no<br>=
longer occurred.<br><br>&gt; Eli Zaretskii &lt;eliz &lt;at&gt; <a href=3D"h=
ttp://gnu.org">gnu.org</a>&gt; writes:<br>&gt; AFAIU, valid types are eithe=
r a primitive type (so you can only create<br>&gt; new types by changing th=
e C code), or you could use make-record to<br>&gt; make a record whose firs=
t slot specifies the type.<br><br>I prepared the following two test files:<=
br><br>;;; test-1.el --- =C2=A0-*- lexical-binding: t; -*-<br>(defun make-t=
est-1-obj (x y)<br>=C2=A0 (record &#39;test-1-obj x y))<br><br>;;; test-2.e=
l --- =C2=A0-*- lexical-binding: t; -*-<br>(defun make-test-2-obj (x y)<br>=
=C2=A0 (let ((obj (make-record &#39;test-2-obj 2 nil)))<br>=C2=A0 =C2=A0 (a=
set obj 1 x)<br>=C2=A0 =C2=A0 (aset obj 2 y)<br>=C2=A0 =C2=A0 obj))<br><br>=
When I evaluated (native-compile &quot;test-1.el&quot;), the error being<br=
>discussed occurred (error &quot;test-1.el&quot; &quot;Type test-1-obj miss=
ing from<br>typeof-types!&quot;).<br>On the other hand, (native-compile &qu=
ot;test-2.el&quot;) did not produce any<br>errors.<br><br>My question is: D=
oes the difference between the `record&#39; function and<br>`make-record&#3=
9; function go beyond just how initial values are<br>specified?=C2=A0 By an=
alogy with vector and make-vector, string and<br>make-string, that&#39;s wh=
at I thought, but is there a clear distinction<br>among Emacs developers? D=
oes `make-record&#39; involve type definition<br>while `record&#39; does no=
t?<br><br>I would appreciate your insights on this matter.<br>--<br># This =
email has been machine translated from Japanese to English.<br>AKIYAMA Kouh=
ei<br><div><br></div></div>

--00000000000060dfd20633bfce49--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Andrea Corallo <acorallo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 29 Apr 2025 21:17:02 +0000
Resent-Message-ID: <handler.76573.B76573.174596138631357 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: Lin Jian <me@HIDDEN>, 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.174596138631357
          (code B ref 76573); Tue, 29 Apr 2025 21:17:02 +0000
Received: (at 76573) by debbugs.gnu.org; 29 Apr 2025 21:16:26 +0000
Received: from localhost ([127.0.0.1]:35731 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u9sJW-00089h-4b
	for submit <at> debbugs.gnu.org; Tue, 29 Apr 2025 17:16:26 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:50916)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <acorallo@HIDDEN>) id 1u9sJS-000882-Hw
 for 76573 <at> debbugs.gnu.org; Tue, 29 Apr 2025 17:16:24 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acorallo@HIDDEN>)
 id 1u9sJM-0005av-NI; Tue, 29 Apr 2025 17:16:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=qnK+eI2AvYg2N0aXZnz6l0Koba8smu5ooVrQrryN8yI=; b=nogw/JdlvQMT89vTe9tZ
 uGl4KN7hf5YXnY9C53Y5Bwn4E45ifGV2sp0rtw7NNzErq0iq0fsVfn0EZTpxRw6Iwaf3CT9CKN0zA
 rJzawDxnc/F4E3AqkCCqcwj8zp84+Uzeo1BMQS0Z+kBSjPgMv/2v207nwTjXe9WfBpVMGjT+EGGnd
 0KHE8JLvrNSI7n0M8kl7jbc4/mU3IsOD+EIdQELq7h/LTU2EcTiSFTHjMMuaT3zatqkJU01muRRDc
 8i/+TMzUeJCR/eE6Jvbk/Tv4xEkhufMzUEsJKxp/jZmw0csjAbnHjl5lym900wlxy1ajGCRZHq0fS
 dkr98X6zFeZRNA==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1u9sJL-0001oo-Nz; Tue, 29 Apr 2025 17:16:15 -0400
From: Andrea Corallo <acorallo@HIDDEN>
In-Reply-To: <86v7qrux53.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 26 Apr
 2025 11:47:52 +0300")
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
 <874iyfoz8c.fsf@HIDDEN> <yp15xist1de.fsf@HIDDEN>
 <87v7qsndw5.fsf@HIDDEN> <868qnnwgyk.fsf@HIDDEN>
 <87plgznyz8.fsf@HIDDEN> <86v7qrux53.fsf@HIDDEN>
Date: Tue, 29 Apr 2025 17:16:15 -0400
Message-ID: <yp1zffysm74.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Lin Jian <me@HIDDEN>
>> Cc: acorallo@HIDDEN,  76573 <at> debbugs.gnu.org
>> Date: Sat, 26 Apr 2025 15:50:03 +0800
>> 
>> 
>> My point is not that the code is correct and the compiler is wrong.  To
>> make it crystal clear, my point is that the following situation is
>> confusing and we should make it less so.  At least the author of
>> el-easydraw agrees[1] with me.
>> 
>> 1. This compiler error only appears in Emacs >= 30.
>
> I don't see this as a problem.  Emacs 31 introduces quite a few
> warnings were questionable or wrong techniques are used in Lisp.
>
>> 2. This compiler error does not appear if native-comp-speed < 2.
>
> This is unfortunate, but not unheard of: the same happens with
> compiling code with GCC, for example.
>
> Andrea, can we somehow test this with all the values of
> native-comp-speed?  Why does this pop up only with some values?

Similarly to GCC the compiler uses the same information inferred for
performing optimizations for producing diagnostics.  As a consequence
diagnostics can vary based on the optimization level.  In this specific
case the pass that performs the reasoning that triggers the message
(comp--fwprop) does run only at speed >= 2.





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Andrea Corallo <acorallo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 29 Apr 2025 21:46:07 +0000
Resent-Message-ID: <handler.76573.B76573.174596315613135 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: Lin Jian <me@HIDDEN>, 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.174596315613135
          (code B ref 76573); Tue, 29 Apr 2025 21:46:07 +0000
Received: (at 76573) by debbugs.gnu.org; 29 Apr 2025 21:45:56 +0000
Received: from localhost ([127.0.0.1]:36215 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u9sm3-0003Pl-PC
	for submit <at> debbugs.gnu.org; Tue, 29 Apr 2025 17:45:56 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41170)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <acorallo@HIDDEN>) id 1u9sm0-0003Ok-3x
 for 76573 <at> debbugs.gnu.org; Tue, 29 Apr 2025 17:45:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acorallo@HIDDEN>)
 id 1u9slu-00028S-7V; Tue, 29 Apr 2025 17:45:46 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=fUuFw5GNmwh9Z7LH5044bpK1GOdsxtlVoYbzKVv54Ok=; b=mbWY/7Q/AXBpPcUKSVC2
 njG8SuDQRXztziFQYFvvWcdWP0Pr8vljLvgB/LflMfulkJAAzc8rJKgVVGpoaV7cDOk7U+TfLiXh0
 CU0C0PfA0VSMkMIRDjQxJ4bp2D2hjVUkNob2GHh/JTWhbjUDmA8ydYOY184wN3PMvtYxzmnwSoSFb
 CeaEExP9mpiUqyXWkBJ4QnoxbAuReLKU/wkrbitTl9lCZjNOw/hc0Af+UnJw58FY5ZEjVZx4RkpGd
 4rHrOQDyqjUfRpgzj/EeUJuCeDvHxD+IR+WyE69w629v6d1x7bdMaNPHXVOUgL4IZcUf9brxuIgen
 ibkhNfwtwm21fQ==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1u9slt-0005l8-0r; Tue, 29 Apr 2025 17:45:45 -0400
From: Andrea Corallo <acorallo@HIDDEN>
In-Reply-To: <86r01fur5w.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 26 Apr
 2025 13:56:59 +0300")
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
 <874iyfoz8c.fsf@HIDDEN> <yp15xist1de.fsf@HIDDEN>
 <87v7qsndw5.fsf@HIDDEN> <868qnnwgyk.fsf@HIDDEN>
 <87plgznyz8.fsf@HIDDEN> <86v7qrux53.fsf@HIDDEN>
 <87jz77nvfb.fsf@HIDDEN> <86r01fur5w.fsf@HIDDEN>
Date: Tue, 29 Apr 2025 17:45:44 -0400
Message-ID: <yp1v7qmsktz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Lin Jian <me@HIDDEN>
>> Cc: acorallo@HIDDEN,  76573 <at> debbugs.gnu.org
>> Date: Sat, 26 Apr 2025 17:06:48 +0800
>> 
>> Eli Zaretskii <eliz@HIDDEN> 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.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Andrea Corallo <acorallo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 30 Apr 2025 08:03:02 +0000
Resent-Message-ID: <handler.76573.B76573.174600014829404 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: AKIYAMA Kouhei <misohena@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, Lin Jian <me@HIDDEN>, 76573 <at> debbugs.gnu.org
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.174600014829404
          (code B ref 76573); Wed, 30 Apr 2025 08:03:02 +0000
Received: (at 76573) by debbugs.gnu.org; 30 Apr 2025 08:02:28 +0000
Received: from localhost ([127.0.0.1]:39256 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uA2Oi-0007e9-5d
	for submit <at> debbugs.gnu.org; Wed, 30 Apr 2025 04:02:28 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51236)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <acorallo@HIDDEN>) id 1uA2Of-0007ds-UP
 for 76573 <at> debbugs.gnu.org; Wed, 30 Apr 2025 04:02:26 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acorallo@HIDDEN>)
 id 1uA2Oa-0000Gj-G3; Wed, 30 Apr 2025 04:02:20 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=e5XUPrgISvw4WQMhzfl3uHYHA2l9+vci8aQNZSutuww=; b=GBtOZIN3WDwFTfOA9x+v
 yRVdzVthaSMUCqdpdypG8wZ6nyfWFdqwTOpMlgBQV6cuszKudWXp6tCMAUAJmbbFnT45rVUScIZr/
 xXEGd3llYVdE1EZrcOcRlzElaeGHFOfFgNNHR8WOl7vuU6BKH3mjT3X60/aeoHj2D4lAlAGTsFvtu
 qWNBqSBGbKbIYPmO99Db7te2kW2Sykayy1sd82rUHjm2pYArYlamJpWLHmAGIiuhjpUf3tnO+3p5m
 9i2+N5fukwknnNY8NkG746LER4vc5uJSi7XRCjc7uQsh97Hhd0saIfKacp7XLO7vJaLJzqOtIo5cD
 eLTzOm/iSdaqOw==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1uA2OY-00040f-Q6; Wed, 30 Apr 2025 04:02:18 -0400
From: Andrea Corallo <acorallo@HIDDEN>
In-Reply-To: <CAAo_Hv8oFG4r16VPVM2Qxn6Jp-29ZXPmq3F=HZk49tOjsj0WeQ@HIDDEN>
 (AKIYAMA Kouhei's message of "Sun, 27 Apr 2025 19:12:23 +0900")
References: <CAAo_Hv8oFG4r16VPVM2Qxn6Jp-29ZXPmq3F=HZk49tOjsj0WeQ@HIDDEN>
Date: Wed, 30 Apr 2025 04:02:18 -0400
Message-ID: <yp1r01arsad.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

AKIYAMA Kouhei <misohena@HIDDEN> writes:

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

Hi!

'make-record' works only because the optimizer knows only about 'record'
:)

I'm more and more convinced now that if 'record' and 'make-record' are
documented to the user the code is valid and the compiler should compile
it.

I'm testing this which demotes the error to a warning:

=========
modified   lisp/emacs-lisp/comp-cstr.el
@@ -35,6 +35,7 @@

;;; Code:
+(require 'warnings)
 (require 'cl-lib)
 (require 'cl-extra) ;HACK: For `cl-find-class' when `cl-loaddefs' is missing.

@@ -338,7 +339,11 @@ comp--intersection
(defun comp-supertypes (type)
   "Return the ordered list of supertypes of TYPE."
   (or (assq type (comp-cstr-ctxt-typeof-types comp-ctxt))
-      (error "Type %S missing from typeof-types!" type)))
+      (progn
+        (display-warning
+         'native-compiler
+         (format "Type %S missing from typeof-types!" type))
+        '(t))))

 (defun comp--union-typesets (&rest typesets)
   "Union types present into TYPESETS."

=========

But if really this is, even if seldomly used, valid code maybe we should
not even signal a warning at this point?  Dunno, Eli WDYT?

  Andrea




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 30 Apr 2025 08:30:02 +0000
Resent-Message-ID: <handler.76573.B76573.17460017502435 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Andrea Corallo <acorallo@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Cc: me@HIDDEN, 76573 <at> debbugs.gnu.org, misohena@HIDDEN
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.17460017502435
          (code B ref 76573); Wed, 30 Apr 2025 08:30:02 +0000
Received: (at 76573) by debbugs.gnu.org; 30 Apr 2025 08:29:10 +0000
Received: from localhost ([127.0.0.1]:39422 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uA2oY-0000dA-8p
	for submit <at> debbugs.gnu.org; Wed, 30 Apr 2025 04:29:10 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:56670)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uA2oM-0000cA-HD
 for 76573 <at> debbugs.gnu.org; Wed, 30 Apr 2025 04:28:59 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uA2oG-0003qy-LI; Wed, 30 Apr 2025 04:28:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=nCohETsmx6zpUIcYX8Zjv9/2IW3ey4LjflzHHoSaIKo=; b=mMx4lKNosqXQ
 2NoDZrdzK3WMWRfW4zVJvfSOu6VZZLHjGLmqXWfBgxxdgNsEDyAd/jYXtQx1PIYEsxe4okIC8y9TR
 nK9Ns0U/kTOBQYti7fGmppHGAhR5eDHZQ3jdIx340Io+rQp26xK9a0pR60ISEw4sr6c0vbaiAIs45
 BvSaVfwBi5PoWRlkf686WFHdTaBshIkoA55tQpYgufLqrulKpPmS3kKZfSOU/xEjMFf4VRJxv1WQy
 Xof5zJE443xjFMtaBfQzIMqh0kdB6uSu3ldhFgd8Cf75XUrZqTRRdWxQnTEN5xYXQYCHFxq788H+D
 ec6gEtlzmVBpnlZX+Gnh7A==;
Date: Wed, 30 Apr 2025 11:28:49 +0300
Message-Id: <86ikmmnjcu.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <yp1r01arsad.fsf@HIDDEN> (message from Andrea Corallo
 on Wed, 30 Apr 2025 04:02:18 -0400)
References: <CAAo_Hv8oFG4r16VPVM2Qxn6Jp-29ZXPmq3F=HZk49tOjsj0WeQ@HIDDEN>
 <yp1r01arsad.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Andrea Corallo <acorallo@HIDDEN>
> Cc: Eli Zaretskii <eliz@HIDDEN>,  76573 <at> debbugs.gnu.org,  Lin Jian
>  <me@HIDDEN>
> Date: Wed, 30 Apr 2025 04:02:18 -0400
> 
> AKIYAMA Kouhei <misohena@HIDDEN> writes:
> 
> > 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.
> 
> Hi!
> 
> 'make-record' works only because the optimizer knows only about 'record'
> :)
> 
> I'm more and more convinced now that if 'record' and 'make-record' are
> documented to the user the code is valid and the compiler should compile
> it.
> 
> I'm testing this which demotes the error to a warning:
> 
> =========
> modified   lisp/emacs-lisp/comp-cstr.el
> @@ -35,6 +35,7 @@
> 
> ;;; Code:
> +(require 'warnings)
>  (require 'cl-lib)
>  (require 'cl-extra) ;HACK: For `cl-find-class' when `cl-loaddefs' is missing.
> 
> @@ -338,7 +339,11 @@ comp--intersection
> (defun comp-supertypes (type)
>    "Return the ordered list of supertypes of TYPE."
>    (or (assq type (comp-cstr-ctxt-typeof-types comp-ctxt))
> -      (error "Type %S missing from typeof-types!" type)))
> +      (progn
> +        (display-warning
> +         'native-compiler
> +         (format "Type %S missing from typeof-types!" type))
> +        '(t))))
> 
>  (defun comp--union-typesets (&rest typesets)
>    "Union types present into TYPESETS."
> 
> =========
> 
> But if really this is, even if seldomly used, valid code maybe we should
> not even signal a warning at this point?  Dunno, Eli WDYT?

Possibly.  Stefan, WDYT?

Also, Andrea, you suggested in a previous message that we should
document make-record as low-level facility, and suggest that new types
are created using cl-defstruct and defclass.  If you still think so, I
think we should indeed make these changes in the documentation.
Stefan, any comments on this aspect?




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76573: 30.1; native compilation fails for record inside function
Resent-From: Andrea Corallo <acorallo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 30 Apr 2025 09:13:02 +0000
Resent-Message-ID: <handler.76573.B76573.174600437311647 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76573
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: me@HIDDEN, Stefan Monnier <monnier@HIDDEN>, 76573 <at> debbugs.gnu.org, misohena@HIDDEN
Received: via spool by 76573-submit <at> debbugs.gnu.org id=B76573.174600437311647
          (code B ref 76573); Wed, 30 Apr 2025 09:13:02 +0000
Received: (at 76573) by debbugs.gnu.org; 30 Apr 2025 09:12:53 +0000
Received: from localhost ([127.0.0.1]:39660 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uA3Ur-00031m-30
	for submit <at> debbugs.gnu.org; Wed, 30 Apr 2025 05:12:53 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47112)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <acorallo@HIDDEN>) id 1uA3Un-00031R-Dd
 for 76573 <at> debbugs.gnu.org; Wed, 30 Apr 2025 05:12:50 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acorallo@HIDDEN>)
 id 1uA3Uh-0000wS-PT; Wed, 30 Apr 2025 05:12:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=i6uMb+01HFoKlrrX5eYZZDsx9IJGu21MvqMjGMw65U0=; b=e2wxwnzTTIk3mawEVGka
 zKcVnlPvcMfUZ/SBb+yJh6xn3uxTJuGiekH9h38uJFlqW1Gnv2diG+lKxw2aMmAWeV1bXSBWxPbOL
 mtbyKLaVcgzM5UI6fC93++QSbIrMrfHrEGTOSl1PTxhu7/GRwbaP4DNNyAhHbyKw0AShSJ1I4Vvac
 HfDCFkCYq9amzS5nJJZhiPWPSroKWuZVmWNdl+uJfbarfOTViPaImmd7EOsbg7puKXP469RvzgoKl
 HHSumLWdUpN5xeH5bIAJIjiRR90tNhH+Gzc+zUfIj0NmIkqdij5m0Ku7omjCAWWf0iWKiwoB/u8Ni
 6yhLzuGUHsVpqw==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1uA3Ug-0004cd-H7; Wed, 30 Apr 2025 05:12:42 -0400
From: Andrea Corallo <acorallo@HIDDEN>
In-Reply-To: <86ikmmnjcu.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 30 Apr
 2025 11:28:49 +0300")
References: <CAAo_Hv8oFG4r16VPVM2Qxn6Jp-29ZXPmq3F=HZk49tOjsj0WeQ@HIDDEN>
 <yp1r01arsad.fsf@HIDDEN> <86ikmmnjcu.fsf@HIDDEN>
Date: Wed, 30 Apr 2025 05:12:42 -0400
Message-ID: <yp1msbyrp11.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Andrea Corallo <acorallo@HIDDEN>
>> Cc: Eli Zaretskii <eliz@HIDDEN>,  76573 <at> debbugs.gnu.org,  Lin Jian
>>  <me@HIDDEN>
>> Date: Wed, 30 Apr 2025 04:02:18 -0400
>> 
>> AKIYAMA Kouhei <misohena@HIDDEN> writes:
>> 
>> > 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.
>> 
>> Hi!
>> 
>> 'make-record' works only because the optimizer knows only about 'record'
>> :)
>> 
>> I'm more and more convinced now that if 'record' and 'make-record' are
>> documented to the user the code is valid and the compiler should compile
>> it.
>> 
>> I'm testing this which demotes the error to a warning:
>> 
>> =========
>> modified   lisp/emacs-lisp/comp-cstr.el
>> @@ -35,6 +35,7 @@
>> 
>> ;;; Code:
>> +(require 'warnings)
>>  (require 'cl-lib)
>>  (require 'cl-extra) ;HACK: For `cl-find-class' when `cl-loaddefs' is missing.
>> 
>> @@ -338,7 +339,11 @@ comp--intersection
>> (defun comp-supertypes (type)
>>    "Return the ordered list of supertypes of TYPE."
>>    (or (assq type (comp-cstr-ctxt-typeof-types comp-ctxt))
>> -      (error "Type %S missing from typeof-types!" type)))
>> +      (progn
>> +        (display-warning
>> +         'native-compiler
>> +         (format "Type %S missing from typeof-types!" type))
>> +        '(t))))
>> 
>>  (defun comp--union-typesets (&rest typesets)
>>    "Union types present into TYPESETS."
>> 
>> =========
>> 
>> But if really this is, even if seldomly used, valid code maybe we should
>> not even signal a warning at this point?  Dunno, Eli WDYT?
>
> Possibly.  Stefan, WDYT?
>
> Also, Andrea, you suggested in a previous message that we should
> document make-record as low-level facility, and suggest that new types
> are created using cl-defstruct and defclass.  If you still think so, I
> think we should indeed make these changes in the documentation.

Possibly, also the fact that it took quite some time to get a bug report
on this is indicative of a not common direct use of 'record' and
'make-record' by users.  I'm interested as well on Stefan opinion on
this.

  Andrea





Last modified: Wed, 30 Apr 2025 09:15:01 UTC

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