From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Paul W. Rankin" via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: declare function/macro private Date: Sun, 6 Jun 2021 22:43:25 +1000 Message-ID: <030ED6D5-BC78-4992-90C5-9EC18221F0DE@bydasein.com> References: <0278C47F-42CE-45C4-B789-83C57DF1A191@bydasein.com> <87r1hftj2t.fsf@gnus.org> Reply-To: "Paul W. Rankin" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11073"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jun 06 14:44:37 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lps8q-0002ay-Mf for ged-emacs-devel@m.gmane-mx.org; Sun, 06 Jun 2021 14:44:36 +0200 Original-Received: from localhost ([::1]:52300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lps8p-0005NW-AH for ged-emacs-devel@m.gmane-mx.org; Sun, 06 Jun 2021 08:44:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lps84-0004hq-Fz for emacs-devel@gnu.org; Sun, 06 Jun 2021 08:43:48 -0400 Original-Received: from sendmail.purelymail.com ([34.202.193.197]:54994) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lps82-0003Mt-Ar for emacs-devel@gnu.org; Sun, 06 Jun 2021 08:43:48 -0400 DKIM-Signature: a=rsa-sha256; b=EXhYNGhKEwrT5v2Vuy83jK/llTFstuHKvlmxHp8cvEGQVGDZOacB2RksZie0SWiJXTR1kzWHrSNART7pky5FXfCAdR/kgo94XISyrdMkhT/6T0tiSa54XUS1+IFrnlEyDV5JXMnHHNkFwwGlSurtireXQyMLCPoznhIhSc9ktS+9ZNrhlOSMAmBPmSRg1cz/2V5Mit3IFbNUuNR6syvE91nVuSWV+zxYxxTmIn5skTLDtOaOlTOluyZjBY81AhuXuyt+b/7pnSS182s8kMIt1XIQV2TEayZ85NII2QZRNlBnknJPRBzAhQQn33xNGFV5v9AyNYhT2DOTHo+sweLkbA==; s=purelymail3; d=bydasein.com; v=1; bh=4XlgIHz1Q3h2XfiK9vuchIhipZXCsP+H5jGMTb4OMI8=; h=Received:From:To; DKIM-Signature: a=rsa-sha256; b=RhomHMHrE4CfMkW4kYbMyquRH/dLPHzIxoqtXTQW+Qkzb6EhOkCmJZXpgUIfgyIzrYYPMmOStt42B38mdXKFskG1y77EmbRwZBJrWvNt08RiZ7+y9GoKcCJZ7GhZ2JZSEIG0rNXJftBOPiQsUmUZctCwIh9Su7pmGh2QzL1jx1l3lljPj0OpVJ9PXwO4lmJAwbb1rCMK9jhsJMpbxxnfPzfdSIgWbs0q6EpgcojGjArqBtdvX7AsM94LMVg7Qaa/1f6xdLLl5Ry14U3yJO38CzhucgFg977o+EVkGkIX7s4cUbj8rh93R7SBJrzfzhzPkDtvtqcLAKT3heCcWi/HqQ==; s=purelymail3; d=purelymail.com; v=1; bh=4XlgIHz1Q3h2XfiK9vuchIhipZXCsP+H5jGMTb4OMI8=; h=Feedback-ID:Received:From:To; Feedback-ID: 791:353:null:purelymail X-Pm-Original-To: emacs-devel@gnu.org Original-Received: by ip-172-30-0-124.ec2.internal (JAMES SMTP Server ) with ESMTPA ID -1746748437; Sun, 06 Jun 2021 12:43:31 +0000 (UTC) In-Reply-To: <87r1hftj2t.fsf@gnus.org> X-Mailer: Apple Mail (2.3654.100.0.2.22) Received-SPF: pass client-ip=34.202.193.197; envelope-from=pwr@bydasein.com; helo=sendmail.purelymail.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270480 Archived-At: > On 6 Jun 2021, at 7:53 pm, Lars Ingebrigtsen wrote: >=20 > "Paul W. Rankin" via "Emacs development discussions." > writes: >=20 >> Given we have a function/macro declare interactive-only property, >> would it be worthwhile to consider a `private' property? >>=20 >> Of course there's already the convention of >> prefix--my-private-function, but my thinking here is that a program >> could declare a function/macro as private, then the compiler could >> signal a warning/error if that function appeared in a library outside >> the library it was defined and declared private. >=20 > The compiler could do this with "--" symbols if we wanted to, I guess. = =20 >=20 >> e.g. in foo.el: >>=20 >> (defun foo-private () >> (declare (private "use `foo-public' instead.")) >> ...) >=20 > I'm not necessarily against this or anything, but I do like the "--" > convention, because it makes it very explicit what's internal and = what's > not. On the other hand, if we had tagging like this, we could also > make (say) font-lock react to this information and make it as obvious = as > the "--" convention. Ah cool, I didn't think of font-lock, but that would be great if a = function declared as internal appears outside of its program then it = gets highlighted in font-lock-warning-face. Then the curious programmer = calls `C-h f' on it and the help buffer could show e.g. This function is internal to and should not be used in other lisp programs. Use instead. The "--" convention is fine and I wouldn't suggest to change/replace = this; it's clear to people what it means once they've learnt what the = convention means. I think requiring a program to explicitly declare something as internal = will cause less trouble than adding a kind of compiler heuristic for = "--" symbol names because there are likely plenty of those where people = have used the name with the perspective that it's just a hint and = doesn't actually do anything. e.g. `imenu--index-alist' is supposedly = internal but any elisp program hooking into Imenu needs to use this = variable. Also I just dislike computer heuristics. I'll revise the initial suggestion from `private' to `internal' since = that's more the Emacs lexicon, i.e. (declare (internal t)) (declare (internal "use `other-function' instead."))=