From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#69387: 30.0.50; A string shouldn't be both a docstring and a return value Date: Sun, 25 Feb 2024 11:29:45 -0500 Message-ID: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26700"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca To: 69387@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 25 18:05:29 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1reHwO-0006es-FP for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 25 Feb 2024 18:05:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1reHvg-0005m5-7L; Sun, 25 Feb 2024 12:04:44 -0500 Original-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 ) id 1reHvd-0005lO-Ss for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2024 12:04:42 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1reHvb-0001MR-27 for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2024 12:04:41 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1reHvz-0004ws-Ei; Sun, 25 Feb 2024 12:05:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Feb 2024 17:05:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69387 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: monnier@iro.umontreal.ca Original-Received: via spool by submit@debbugs.gnu.org id=B.170888068018933 (code B ref -1); Sun, 25 Feb 2024 17:05:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Feb 2024 17:04:40 +0000 Original-Received: from localhost ([127.0.0.1]:59764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1reHvb-0004vB-Jk for submit@debbugs.gnu.org; Sun, 25 Feb 2024 12:04:40 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:45898) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1reHvY-0004uI-K2 for submit@debbugs.gnu.org; Sun, 25 Feb 2024 12:04:36 -0500 Original-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 ) id 1reHO0-0001UJ-SD for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2024 11:29:56 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1reHNy-0001BH-Tf for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2024 11:29:56 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 55DF310005D for ; Sun, 25 Feb 2024 11:29:51 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1708878590; bh=KrdV64jVh6dfHn72d2Bh2JS+n/vl/JlZo9e1ajZKchw=; h=From:To:Subject:Date:From; b=KyTPM6ig1ZCIUPv8rM5sBA4QEgbrXAt09UqSeyGtJ6GIdJzr4TzPmSvGfkoGnXTKy GTyWBWvJiXYLQMoVcfcLXKBdcbcbF8aMOtsAlVV590uJ8MTrWtLPLoORANmIYanKvS /Ng1R2WInDCxAFOCRh2sAGtqpjqqpUXLh8i5RLrn0Qpe4huz0riFnzenA9ZfW64PM3 lK8PHCRJiSRhohzqq9MfzWRYdn/p14RQbgWOM+q+8MrE+M9hqk/BJtBv4uVpe1KD3q JcUxTo3oIGMovdH0bI/9jq0M4bV7Dd+rGsbQckHt/ZzpMExaccIA7L/cgTb1iZxtvA Yvbu8Abu3xW3A== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 5BA5D10004A for ; Sun, 25 Feb 2024 11:29:50 -0500 (EST) Original-Received: from alfajor (unknown [45.72.205.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 42527120470 for ; Sun, 25 Feb 2024 11:29:50 -0500 (EST) Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280625 Archived-At: Package: Emacs Version: 30.0.50 Currently, ELisp defines (lambda (blabla) "Help!") as a function that returns "Help!" *and* whose docstring is "Help!". As seen in commit eeb89a5cb292bffe40ba7d0b0cf81f82f8452bf8, it can be a source of annoyance as well. I cannot remember finding source code which makes use of this "feature". My impression is that our docs document this behavior simply because that's how it happened to work rather than how it should work. This is documented in the texinfo under "Function Documentation" where it says: [... effects, it has no effect if it is not the last form in the body. Thus, in practice, there is no confusion between the first form of the body and the documentation string; if the only body form is a string then it serves both as the return value and as the documentation. I think we should change that to say that if the only body form is a string then it serves as the return value and not as the documentation. This will/would require a few changes to `macroexp.el` and `bytecomp.el`, but it should be minor. It shouldn't introduce any significant breakage either because the only effect will be to make it so some functions won't have a docstring any more, but most (all?) of those function never expected to have a docstring in the first place. Stefan