GNU bug report logs - #61730
30.0.50; Compiler warnings for delq and delete

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Thu, 23 Feb 2023 10:30:01 UTC

Severity: wishlist

Found in version 30.0.50

Full log


View this message in rfc822 format

From: Mattias EngdegÄrd <mattias.engdegard <at> gmail.com>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: Ruijie Yu <ruijie <at> netyu.xyz>, Eli Zaretskii <eliz <at> gnu.org>, 61730 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#61730: 30.0.50; Compiler warnings for delq and delete
Date: Sun, 21 May 2023 10:42:30 +0200
21 maj 2023 kl. 05.57 skrev Michael Heerdegen <michael_heerdegen <at> web.de>:

>> Maybe we can take inspirations from other langagues?  In rust we have
>> the `#[must_use]' attribute [1], and in C++17 and C23 we have the
>> `[[nodiscard]]' attribute [2] [3].
> 
> These are not bad.  I like "nodiscard".

There are probably better names than the chosen one but I went back and forth on it for a while so we should let it sink in for a bit before switching again. There is still some time before the release of Emacs 30.

>> Also, is there any definitive relation between this
>> 'important-return-value property and the existing "pure" function
>> declaration?  Like the `(declare (pure t))' thing in the front of a
>> defun.
> 
> Interesting question.  Does 'pure' (or 'side-effect-free') imply
> 'important-return-value'?

Not `pure`, but (almost) all functions declared `pure` are also `side-effect-free` (possibly error-free).

`side-effect-free` often produces the same warning as `important-return-value` for calls that don't use the return value, but the entire call can be deleted silently under some circumstances.


21 maj 2023 kl. 07.55 skrev Eli Zaretskii <eliz <at> gnu.org>:

> no-discard-value, I hope.  Just "nodiscard" is too terse (discard
> what?).

I agree, we should prefer more descriptive names. Let's see what we can come up with.





This bug report was last modified 1 year and 286 days ago.

Previous Next


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