From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48264: [PATCH v3 03/15] Add and use BUFFER_DEFAULT_VALUE_P Date: Fri, 07 May 2021 15:58:23 +0300 Message-ID: <83wnsabt00.fsf@gnu.org> References: <877dkbsj9d.fsf@catern.com> <20210506213346.9730-4-sbaugh@catern.com> <83czu3c88w.fsf@gnu.org> <87tuner9mw.fsf@catern.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30077"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48264@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 07 15:07:02 2021 Return-path: Envelope-to: geb-bug-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 1lf0C5-0007gq-RR for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 May 2021 15:07:01 +0200 Original-Received: from localhost ([::1]:36062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lf0C4-0002GS-SO for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 May 2021 09:07:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lf04M-00032N-2j for bug-gnu-emacs@gnu.org; Fri, 07 May 2021 08:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60441) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lf04L-0001WK-QW for bug-gnu-emacs@gnu.org; Fri, 07 May 2021 08:59:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lf04L-0006Uf-Pn for bug-gnu-emacs@gnu.org; Fri, 07 May 2021 08:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 May 2021 12:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48264 X-GNU-PR-Package: emacs Original-Received: via spool by 48264-submit@debbugs.gnu.org id=B48264.162039232024949 (code B ref 48264); Fri, 07 May 2021 12:59:01 +0000 Original-Received: (at 48264) by debbugs.gnu.org; 7 May 2021 12:58:40 +0000 Original-Received: from localhost ([127.0.0.1]:43752 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lf040-0006UL-JC for submit@debbugs.gnu.org; Fri, 07 May 2021 08:58:40 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lf03y-0006UF-Di for 48264@debbugs.gnu.org; Fri, 07 May 2021 08:58:38 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47146) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lf03t-0001EW-3y; Fri, 07 May 2021 08:58:33 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1938 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1lf03r-0004Hj-VO; Fri, 07 May 2021 08:58:33 -0400 In-Reply-To: <87tuner9mw.fsf@catern.com> (message from Spencer Baugh on Fri, 07 May 2021 08:49:59 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205931 Archived-At: > From: Spencer Baugh > Cc: 48264@debbugs.gnu.org > Date: Fri, 07 May 2021 08:49:59 -0400 > > Eli Zaretskii writes: > >> From: Spencer Baugh > >> Date: Thu, 6 May 2021 17:33:34 -0400 > >> Cc: Spencer Baugh > >> > >> This makes the code more clear and allows us to more easily change how > >> this property is determined. > > > > Does it? Can you explain why you think so? It looks like we are > > replacing clear code with an equally clear different code. > > Well, "if (idx > 0)" as a conditional requires a fair bit of digging in > the implementation of DEFVAR_PER_BUFFER variables to understand. On the > other hand, "if (BUFFER_DEFAULT_VALUE_P (offset))" is immediately clear: > We're checking if this variable has a default value. It's the other way around here: the test "if (idx > 0)" is clear, whereas "if (BUFFER_DEFAULT_VALUE_P (offset))" makes me go look up the definition of the macro, because the name is not expressive enough, and the argument "offset" doesn't help, either. > By hiding the implementation detail of "idx", we both remove the need to > know what idx is, and make it easier to later change the implementation > (as a later commit does). I don't want to hide the implementation details, I want the code to speak for itself. If you can come up with a change that will make the code really more clear, fine; otherwise I think we should add comments there to explain the test.