bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#69387: 30.0.50; A string shouldn't be both a docstring and a return


From: Mattias Engdegård
Subject: bug#69387: 30.0.50; A string shouldn't be both a docstring and a return value
Date: Tue, 5 Mar 2024 14:16:50 +0100

4 mars 2024 kl. 15.46 skrev Eli Zaretskii <eliz@gnu.org>:

> Do we need to say something about this change in NEWS?

Yes, here is a complete patch.

The cl-lib definition forms (cl-defun, cl-defsubst, cl-defmacro etc) are 
unaffected by the change as they don't have the dual-use doc-string problem.

The doc-string mechanism change should be sound and safe. The warning is only 
an annoyance for people writing code like

(defun my-constant-fun ()
  "some-useful-string")

which isn't common but not necessarily bad style either, which would be the 
main argument against the warning -- the programmer needs to add a doc string 
or `nil` before the string to silence the compiler.

It's more common to see no-op functions like

(defun my-no-op-fun ()
  "This function is unfinished.")

and here it's probably a good idea to make the programmer be more explicit 
about the return value.

Attachment: 0001-Use-single-string-literal-as-return-value-not-doc-st.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]