From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: Lexical vs. dynamic: small examples? Date: Mon, 10 Jan 2022 14:10:18 +0100 Message-ID: <87y23nspmt.fsf@zoho.eu> References: Reply-To: Emanuel Berg Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10739"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:Cp1KQF5XaotqQeaJjIB2dvaJv80= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 10 14:18:56 2022 Return-path: Envelope-to: geh-help-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 1n6uZc-0002dn-4u for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 10 Jan 2022 14:18:56 +0100 Original-Received: from localhost ([::1]:35956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6uZZ-0004xx-H5 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 10 Jan 2022 08:18:54 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6uRh-0008TR-LE for help-gnu-emacs@gnu.org; Mon, 10 Jan 2022 08:10:46 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]:47814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6uRS-0008T8-Ks for help-gnu-emacs@gnu.org; Mon, 10 Jan 2022 08:10:45 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1n6uRP-0001Fb-AM for help-gnu-emacs@gnu.org; Mon, 10 Jan 2022 14:10:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.248, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:135177 Archived-At: Drew Adams wrote: >> But here it also has a functional value. Or to be even more >> precise, the functional value is also what is appealing, >> since I think it started in that end. > > tl;dr: > 1. It can be useful. 2. It's not foolproof. > ___ > > I guess you're referring to this (from the > `dyna-show.el' Commentary)? > > [I]f a function has the same name as a dynamic > variable, then its occurrences are also > highlighted, as if they were occurrences of > the variable. > > For example `font-lock-mode' is a variable as > well as a function. Both kinds of occurrences > of that symbol are highlighted the same. > > Whether this is considered a feature or a > limitation, the reason is that it requires no > analysis of the code (which would anyway be > problematic and limited) to determine how each > occurrence is used. > > The Commentary calls it out as a limitation. > And the sentence above comes right after this > additional caveat: > > The simple built-in test `special-variable-p' is used. > That test is not 100% reliable. It doesn't respect vacuous > `defvar' sexps, which declare a variable to be special in > a given context, without assigning a value to the > variable. Instead, it uses `defvar',`defconst', and > `defcustom' sexps with a value arg present. Well, yes, that's a good example, but actually the functional gain starts with the programmer thinking "hey, what should it be called?" - "obey tradition" (follow the convention) and even at that point the harsh reality of a programmer gets a little "bit" easier ;) -- underground experts united https://dataswamp.org/~incal