Eli Zaretskii <eliz@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 69521) by debbugs.gnu.org; 3 Mar 2024 11:21:11 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 03 06:21:10 2024 Received: from localhost ([127.0.0.1]:39836 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rgju2-0005OT-GD for submit <at> debbugs.gnu.org; Sun, 03 Mar 2024 06:21:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35122) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1rgjtx-0005Nm-NX; Sun, 03 Mar 2024 06:21:09 -0500 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 1rgjrH-0000kK-UE; Sun, 03 Mar 2024 06:18:19 -0500 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=RNk3inunL4o+rDe8iy39q6eEb5wpf+Vp8EBRS63jz+M=; b=NwjS2lYTWD/v KOCWpIRsDPRjiCe8fYZyKE2x6pE1m9D68DREzM4RZg++2eTBgTs5XTF19NEAqfisBQpL8YzwKboCI M55omGZ1JAxh+aaZ/u6U7/6t0+BNCjApg1o0lZb+wp4d9pHyGg8HpC6mCNIafzVESqJ7uWTpiQjz2 N3+DMhbZydSeC62idNxLqcuJloKPJ8bZmkQ1Wsc7CA1xn9ue7Fkr7UnUpyDJlTOFWUTjPr9Q3jT7l R01cJRUuoX2Z7U4rQmVBBENAWEhFUMYeAS4DkbETLIX3rHMwzLYippcYaF7BdmSljBdqcTAdhzkRb /CChHl1u2MJ2gSJXtR0qlQ==; Date: Sun, 03 Mar 2024 13:18:14 +0200 Message-Id: <86frx7o96x.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Adam Porter <adam@HIDDEN> In-Reply-To: <b7ea82de-7c7b-48ad-8352-df35a56e0143@HIDDEN> (message from Adam Porter on Sun, 3 Mar 2024 04:49:02 -0600) Subject: Re: bug#69521: 29.1; Adding a DECLARE spec equivalent to DECLARE-FUNCTION References: <b7ea82de-7c7b-48ad-8352-df35a56e0143@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 69521 Cc: 69521 <at> debbugs.gnu.org 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 (---) severity 69521 wishlist thanks > Date: Sun, 3 Mar 2024 04:49:02 -0600 > From: Adam Porter <adam@HIDDEN> > > In light of [this thread], this seems like a good time to propose this > idea: to enhance the `declare' form with a `function' spec equivalent to > the top-level `declare-function' form. This allows keeping the > declaration inside the function that makes it necessary, which has a few > advantages: Thanks, but I think this should be discussed on emacs-devel first. The bug tracker is not a good vessel of discussing ideas; in particular. quite a few of people who should be part of such a discussion don't read bug-gnu-emacs regularly, and must be explicitly CC'ed to take notice. So I suggest to start the discussion on emacs-devel, and only switch here if/when the idea and its implementation aspects are clear enough to post a patch. Thanks.
bug-gnu-emacs@HIDDEN
:bug#69521
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 3 Mar 2024 10:49:42 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 03 05:49:42 2024 Received: from localhost ([127.0.0.1]:39813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rgjPZ-0004bO-Pj for submit <at> debbugs.gnu.org; Sun, 03 Mar 2024 05:49:42 -0500 Received: from lists.gnu.org ([209.51.188.17]:36102) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <adam@HIDDEN>) id 1rgjPV-0004bB-3e for submit <at> debbugs.gnu.org; Sun, 03 Mar 2024 05:49:40 -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 <adam@HIDDEN>) id 1rgjP1-0001ri-S8 for bug-gnu-emacs@HIDDEN; Sun, 03 Mar 2024 05:49:07 -0500 Received: from quail.birch.relay.mailchannels.net ([23.83.209.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <adam@HIDDEN>) id 1rgjP0-0001BV-Gw for bug-gnu-emacs@HIDDEN; Sun, 03 Mar 2024 05:49:07 -0500 X-Sender-Id: dreamhost|x-authsender|adam@HIDDEN Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 33B6CC11BE for <bug-gnu-emacs@HIDDEN>; Sun, 3 Mar 2024 10:49:04 +0000 (UTC) Received: from pdx1-sub0-mail-a203.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id C34E3C10CD for <bug-gnu-emacs@HIDDEN>; Sun, 3 Mar 2024 10:49:03 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1709462943; a=rsa-sha256; cv=none; b=HBBVuQdDxLNd50EkN4wYELcd0dcegBjpPHg8smKqO5Z9UQvMMxn84evOnjGEK1+LqBSS+V rkTiBsWLVledvCqPSZPqs/6YJnRbtrjUVojJ7MQgzcD0D9yaWLFaU6ny5Z6ym5hY/Nikkj uTFSrlHZH2IwsvKNOcbURiDgpS9jxvA+8a6XoQsEZxlky8AUBjnWH5/zvNCODzHHmcgIif ocjM5XJUf9tSntdOFOAS1elJgwvqldaO4PhxbtMusEK7cddk9D1Z27bCff9F5h17lue3tB zN/7hdWzLDfJdalH2EW9x0Y1G8oP0hC7aw/QreyASBIMAZMxb39zztSaNo+1Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1709462943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=rQjqMxpId+M34TvRrtskiJTg/96Q1HmW+40Kg5sYFO4=; b=nMqzlkf22JfaAnUDrEKVGZq1XV2RYpuZWi1XpNAwsictu8ue0ks5jswg8G9HaEK47H4TFB GI+7otPZHMT4mWG+oiTjBbknkvm8vg9iZzwsFusBZ1dJmO++/Bp5loq7TztOAdENEjbYNu H5oE/ktK5ZGCx2Hvz9GZys38gH/IKl4vPX0DwhS9Vn5fwS7tMGZ3xeIB9km2nh/xpHA1/7 y0ygaZU1lb5Z0deRVF/YestG86r9j+H7DGyTAn2uFC8Lqmxd0OoAXzf+x4mfG5b/A3VbtR V7gszmXZ1ti4hD9VShbCdnEzNgilLerpjF8kySa4FzotCidojkHQEWiIBTploQ== ARC-Authentication-Results: i=1; rspamd-7f9dd9fb96-cdljl; auth=pass smtp.auth=dreamhost smtp.mailfrom=adam@HIDDEN X-Sender-Id: dreamhost|x-authsender|adam@HIDDEN X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|adam@HIDDEN X-MailChannels-Auth-Id: dreamhost X-Trouble-Wiry: 5ef3f8f50a38359b_1709462944029_819258068 X-MC-Loop-Signature: 1709462944028:2880327590 X-MC-Ingress-Time: 1709462944027 Received: from pdx1-sub0-mail-a203.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.111.192.177 (trex/6.9.2); Sun, 03 Mar 2024 10:49:04 +0000 Received: from [10.28.0.30] (unknown [45.131.192.18]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adam@HIDDEN) by pdx1-sub0-mail-a203.dreamhost.com (Postfix) with ESMTPSA id 4TndqM287fzGs for <bug-gnu-emacs@HIDDEN>; Sun, 3 Mar 2024 02:49:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alphapapa.net; s=dreamhost; t=1709462943; bh=rQjqMxpId+M34TvRrtskiJTg/96Q1HmW+40Kg5sYFO4=; h=Date:To:From:Subject:Content-Type:Content-Transfer-Encoding; b=OBl9Ds3veh2qtof67zaeyFF3psSZzCee/uhE/L358nAzl/T/UZONguAxhSTaKPFft 21rc/gOcm9q1842yZbd3cwjTA9gu4V1eJbR1SPOo8TJsHjXjatfMH77KMjcFCvD3fX 6GJl+Qtd5LHizxdnsvDbl7AP4fj94H8m7Y22PVxitwxGS2sR2mdzGqSWbXIPKFLfZZ DPS8vXd6Zu8gnE+ua6FAZ4paNmq/7sUw/hQ7//n3czan0SXgMNu86NrsZKTGXVHlrB 6zZglb+AoEoGgGoU0dCxAxNyBefuZ8UDcmvTjatWnMZN9ymOWBDJ4dKJi+nkI++c/B lAXaxt978MqOg== Message-ID: <b7ea82de-7c7b-48ad-8352-df35a56e0143@HIDDEN> Date: Sun, 3 Mar 2024 04:49:02 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: bug-gnu-emacs@HIDDEN From: Adam Porter <adam@HIDDEN> Subject: 29.1; Adding a DECLARE spec equivalent to DECLARE-FUNCTION Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: neutral client-ip=23.83.209.151; envelope-from=adam@HIDDEN; helo=quail.birch.relay.mailchannels.net X-Spam_score_int: 0 X-Spam_score: -0.0 X-Spam_bar: / X-Spam_report: (-0.0 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL=1.31, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.7 (-) 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: -2.7 (--) Hi, In light of [this thread], this seems like a good time to propose this idea: to enhance the `declare' form with a `function' spec equivalent to the top-level `declare-function' form. This allows keeping the declaration inside the function that makes it necessary, which has a few advantages: 1. It clearly indicates which function makes the declaration necessary (i.e. which function contains calls to the function in another library). 2. If the function is moved to another file, the declaration moves with it. 3. If the function is removed, the declaration is removed with it. 4. It reduces the number of top-level forms. Also, it seems like a natural fit, i.e. `declare-function' to `(declare (function ...))'. As an experiment, I implemented this in [Ement] about 10 months ago, and I've neither seen nor heard of any problems with it. Here's the code that implements it: ┌──── │ (eval-and-compile │ (defun ement--byte-run--declare-function (_name _args &rest values) │ "Return a `declare-function' form with VALUES. │ Allows the use of a form like: │ │ (declare (function FN FILE ...)) │ │ inside of a function definition, effectively keeping its │ `declare-function' form inside the function definition, ensuring │ that stray such forms don't remain if the function is removed." │ `(declare-function ,@values)) │ │ (cl-pushnew '(function ement--byte-run--declare-function) defun-declarations-alist :test #'equal) │ (cl-pushnew '(function ement--byte-run--declare-function) macro-declarations-alist :test #'equal)) └──── In use, it looks like this: ┌──── │ (defun ement-notifications--make (notification) │ "Return an `ement-notification' struct for NOTIFICATION. │ NOTIFICATION is an alist representing a notification returned │ from the \"/notifications\" endpoint. The notification's event │ is passed through `ement--make-event'." │ (declare (function ement--make-event "ement")) │ (pcase-let (((map room_id _actions _ts event read) notification)) │ (make-ement-notification :room-id room_id :readp read │ :event (ement--make-event event)))) └──── Would this be an acceptable addition to Emacs Lisp? If so, I'd be glad to prepare a patch. Thanks, Adam [this thread] <https://lists.gnu.org/archive/html/emacs-devel/2024-03/msg00057.html> [Ement] <https://elpa.gnu.org/packages/ement.html>
Adam Porter <adam@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#69521
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.