From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: A short defense of shorthands.el (but CL packages are still better) (Was: Help sought understanding shorthands wrt modules/packages) Date: Thu, 03 Nov 2022 23:28:27 -0400 Message-ID: References: Reply-To: rms@gnu.org Content-Type: text/plain; charset=Utf-8 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27314"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org To: =?iso-8859-1?Q?Jo=C3=A3o_T=C3=A1vora?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 04 04:29:12 2022 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 1oqnOK-0006tf-Eh for ged-emacs-devel@m.gmane-mx.org; Fri, 04 Nov 2022 04:29:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqnNf-0002iI-CP; Thu, 03 Nov 2022 23:28:31 -0400 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 1oqnNd-0002i3-To for emacs-devel@gnu.org; Thu, 03 Nov 2022 23:28:29 -0400 Original-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 ) id 1oqnNd-0005Jv-Ko; Thu, 03 Nov 2022 23:28:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=d2gH44AEdgih0EXZsJi8+oOlMo5r2fNqUk96eJ5YeaE=; b=CM57jWnY8UBd 6jRJ3DHqiYQuP2azUSYY8fL8c+qQ4/d6ao60HKQBPwpU1pHJXx7AzmU7yys9CgUMvUNw4XNdV7PaO iH1F0uFlkM42zZNr19IJypCAEp02KBejdsON0AIyCQ3Ny2VdnAlRt2f+q0B+KrNCI5eRMpgQeANuJ Lw4orkob4dh6HlVBi4uvr0VMRTW1c+Ptr5jl0ejeBHebx6KSEdEj/xIGv9chEHaYGD+tq5/PRlHTH dZiIRaAJPGzuoxvOb/XmJWY7AgkenOTJAfsmqiFOjeEMeP9lsXtM+ofO75oQ7mRoiuf4dtXRMcOWy vs34BmmAMu9gY2IIaUQTgw==; Original-Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1oqnNb-0000aG-V0; Thu, 03 Nov 2022 23:28:28 -0400 In-Reply-To: (message from =?iso-8859-1?Q?Jo=C3=A3o_T=C3=A1vora?= on Thu, 3 Nov 2022 20:04:18 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299107 Archived-At: [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] Does shorthands break grep? Let's look at a few cases. * The case you brought up. > (defvar x--bar 42) > (defun x-foo () x--bar) > (provide 'x) > ;; x.el ends here > ;; Local Variables: > ;; read-symbol-shorthands: (("x-" . "xenomorph-")) > ;; End: > Its user file yummy.el > (require 'x) > (defun yummy () (x-foo)) > ;; yummy.el ends here > ;; Local Variables: > ;; read-symbol-shorthands: (("x-" . "xenomorph-")) > ;; End: If that's what files x.el and yummy.el contain, I don't think anyone will grep for `xenomorph-foo'. The code in yummy.el actually says `x-foo', so that is what someone will grep for, and grep will find that in x.el. So I don't think this case causes any problem with grep. * A user program foo.el requires strings.el. Consider strings.el and s.el, strings.el defines strings- aliases for the functions in s.el by loading s.el with a renaming. foo.el should call functions named `strings-foo', etc., But strings.el does not explicitly contain those names. So grep will work properly on foo.el but fail on strings.el but not on foo.el. We can fix that by adding to strings.el text such as (ignore ;;This is for grep to find. The definitions are in s.el. (defun strings-foo ()) ) so that grep will find those function names there, and the user will see to look in s.el for the definitions. * Something like what CL packages do. Suppose you want a file foo.el to refer to functions in the frob "package" while eliding its name prefix, `frob:'. For instance, `activate' in foo.el would stand for `frob:activate'. foo.el can have a shorthand to rename `activate' to `frob:activate'. If you grep for `activate', grep will find uses of it in foo.el, but also that renaming in foo.el. This case does not pose a problem for grep. When you see the renaming of `activate' to `frob:activate' in foo.el, you will grep for `frob:activate' and find that in the frob "package". This does the same job as CL packages except that it avoids heuristics and search paths. Renamings are specified explicitly rather than found due to the existence or nonexistence of certain symbols in various packages. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)