GNU bug report logs - #66908
Exposing more public nadvice API

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Philip Kaludercic <philipk@HIDDEN>; dated Fri, 3 Nov 2023 08:35:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 66908 <at> debbugs.gnu.org:


Received: (at 66908) by debbugs.gnu.org; 3 Nov 2023 16:23:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 03 12:23:29 2023
Received: from localhost ([127.0.0.1]:59595 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qywxF-0007dh-EF
	for submit <at> debbugs.gnu.org; Fri, 03 Nov 2023 12:23:29 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:36510)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1qywxC-0007dS-LO
 for 66908 <at> debbugs.gnu.org; Fri, 03 Nov 2023 12:23:27 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 239A5442E70;
 Fri,  3 Nov 2023 12:22:45 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1699028564;
 bh=3rh/oGNyC5mpJxihX5dxF+DQaTzl3ezrffoFDX9eS+0=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=J2woRffUgyRJdwPDSBBPHu49BYp9jDlQIRCcYUY6SWcy4R3PkE27TDuXirgtPFMsj
 AX9x+1UZvs3dgweWB8eeBJRX/1ljU4o9z2yawRhgVPRIDGuuBTDf/3u3WWw5voQt9T
 Sj1j3YndZ6OPidfJUnPinCqcOyZFm3pzTgjaWEP2elgmus5SqWwo1z2aG+Xw8Ho6sn
 R7wMPqtYLqjgoWmZ3YFmLs33E927yWYYCxH7s0goioIbFYdI9Cg3wxPM2qDYnQl47e
 M4JWgRYYjzrbXJK33vjI/7Few+4VDucBvdBxY+oNze8Wbvs3/wKHuzKI4iMr/2FCUl
 gXwD+I4vmE6lQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 0796F442E6E;
 Fri,  3 Nov 2023 12:22:44 -0400 (EDT)
Received: from alfajor (unknown [23.233.149.155])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CF15212022A;
 Fri,  3 Nov 2023 12:22:43 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#66908: Exposing more public nadvice API
In-Reply-To: <878r7fw802.fsf@HIDDEN> (Philip Kaludercic's message of "Fri, 
 03 Nov 2023 08:34:05 +0000")
Message-ID: <jwvpm0qq0nu.fsf-monnier+emacs@HIDDEN>
References: <878r7fw802.fsf@HIDDEN>
Date: Fri, 03 Nov 2023 12:22:42 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.010 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66908
Cc: 66908 <at> debbugs.gnu.org, Visuwesh <visuweshm@HIDDEN>
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 (---)

> I would like to ask if it would be possible to have a public and
> "official" way to access information about advised functions, since all
> the accessory functions defined by `oclosure-define' appear to be marked
> as internal.

[ `oclosure-define` always define accessors as internal, indeed.
  I decided it was simpler this way, since it's easy enough to add
  aliases for those accessors we want to export.  ]

> Specifically `advice-cd*r' would be useful,

It's clearly the internal function most frequently used outside of
`nadvice.el`, indeed.
I think it'd be OK to promote that function to a non-internal name.

> though it might be that we (Visuwesh and I) are trying to do the wrong
> thing, since we want the return value to get a more sensible response
> from `func-arity' -- and I recall we had conversations about the
> complexity of this issue in the past before.

There are very few places where `func-arity` can be used reliably,
indeed and most of those cases are better served by
`help-function-arglist`.

In the case where `func-arity` is used for backward compatibility
purposes (where reliability is not really possible anyway), I've
generally recommend the use of

    (condition-case nil
        ...
      (wrong-number-of-aruments
        ...))

instead.  It comes with its own failure modes, of course, but it's
usually easier to use and I found it to fail less often in practice
(because it's not affected by wrappers like those introduced by advice
or `apply-partially`).


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66908; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Nov 2023 08:34:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 03 04:34:56 2023
Received: from localhost ([127.0.0.1]:56717 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qypdo-0005rd-IO
	for submit <at> debbugs.gnu.org; Fri, 03 Nov 2023 04:34:56 -0400
Received: from lists.gnu.org ([2001:470:142::17]:45734)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1qypdj-0005rJ-QB
 for submit <at> debbugs.gnu.org; Fri, 03 Nov 2023 04:34:55 -0400
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 <philipk@HIDDEN>)
 id 1qypd4-0002Fj-P9
 for bug-gnu-emacs@HIDDEN; Fri, 03 Nov 2023 04:34:11 -0400
Received: from mout01.posteo.de ([185.67.36.65])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philipk@HIDDEN>)
 id 1qypd3-00062K-2K
 for bug-gnu-emacs@HIDDEN; Fri, 03 Nov 2023 04:34:10 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 6CCDA240027
 for <bug-gnu-emacs@HIDDEN>; Fri,  3 Nov 2023 09:34:06 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1699000446; bh=S7a2ELNEfNdwjDeRObtmaTNajDBmp/0Ux0rK0h34eC0=;
 h=From:To:Subject:Autocrypt:Date:Message-ID:MIME-Version:From;
 b=Vb2QhziRawmNW28CCJK7A4AjNc85iZqem/GgM5kcsiMPojK8BWx/05anVf3GW6yE0
 fmn/cmSvDPhNvIM1f8BSAPjnipOpiXdcQovuRmNpiIP0euSz/QR8JU27638ciH4Ebx
 Z1inPNa5KJFjQTuLJjVeJ0yRsjWE/7QoSEJkqeSXXZBUsDrAVih7Vebw7ZD6Gy6cgA
 ccshwT6sMR/WojYrTND6hT3jtPMi4k0tnSZVzI3lj3HSK64okHN2vOs/kanyF2rQ3n
 IQC8B9G89H7HBAt+XaFb5f6eHdekoBCH6BhVIRHV1x+K7z8qFTWEW2yInpxDVRMdL+
 PWMyba61YETQA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4SMDYT6wdKz9rxF
 for <bug-gnu-emacs@HIDDEN>; Fri,  3 Nov 2023 09:34:05 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Exposing more public nadvice API
X-Debbugs-CC: Stefan Monnier <monnier@HIDDEN>, Visuwesh
 <visuweshm@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
Date: Fri, 03 Nov 2023 08:34:05 +0000
Message-ID: <878r7fw802.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@HIDDEN;
 helo=mout01.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 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_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 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-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
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.0 (/)


I would like to ask if it would be possible to have a public and
"official" way to access information about advised functions, since all
the accessory functions defined by `oclosure-define' appear to be marked
as internal.

Specifically `advice-cd*r' would be useful, though it might be that we
(Visuwesh and I) are trying to do the wrong thing, since we want the
return value to get a more sensible response from `func-arity' -- and I
recall we had conversations about the complexity of this issue in the
past before.




Acknowledgement sent to Philip Kaludercic <philipk@HIDDEN>:
New bug report received and forwarded. Copy sent to monnier@HIDDEN, visuweshm@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to monnier@HIDDEN, visuweshm@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#66908; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 3 Nov 2023 16:30:02 UTC

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