From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Change in files.el Date: Sat, 28 Jan 2017 18:08:20 +0200 Message-ID: <8360kzyxor.fsf@gnu.org> References: <83mvebzh0k.fsf@gnu.org> <83bmurz0y9.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1485619744 868 195.159.176.226 (28 Jan 2017 16:09:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 28 Jan 2017 16:09:04 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 28 17:09:00 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXVYR-0007DV-2c for ged-emacs-devel@m.gmane.org; Sat, 28 Jan 2017 17:08:43 +0100 Original-Received: from localhost ([::1]:52339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXVYW-00018J-F3 for ged-emacs-devel@m.gmane.org; Sat, 28 Jan 2017 11:08:48 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXVYL-000173-Uo for emacs-devel@gnu.org; Sat, 28 Jan 2017 11:08:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXVYI-0006No-08 for emacs-devel@gnu.org; Sat, 28 Jan 2017 11:08:37 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXVYH-0006Nk-Si; Sat, 28 Jan 2017 11:08:33 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2071 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cXVYH-0003W9-3Z; Sat, 28 Jan 2017 11:08:33 -0500 In-reply-to: (message from Stefan Monnier on Sat, 28 Jan 2017 10:40:41 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:211700 Archived-At: > From: Stefan Monnier > Date: Sat, 28 Jan 2017 10:40:41 -0500 > > >> - So that you don't have to wrap each and every use inside an `if'. > >> - Or so you don't have to fix the docstring to say what happens when the > >> value is nil. > >> - Or so you can use `add-function' on it. > >> - More generally, so that you can slightly change its behavior without > >> having to re-implement the default behavior by hand. > >> - Also, so as to make sure that it is *possible* to reimplement the > >> default behavior by hand (i.e. to make sure the predicate has access to all > >> the info it needs to reproduce the default behavior). > > These sound minor to me (and the last two are also possible without > > the requirement, AFAIU). > > Hmm... how do you get the last two without that requirement? Are we still talking about a predicate, i.e. a function that returns either t or nil? If so, I think the last two are so trivial that I don't know where to begin answering your question. > > By contrast, insisting on a function value instead of the default nil > > forces me to go through at least one more level of indirection when > > I need to understand what happens in a function that references such > > variables, which sounds like a more serious trouble from my POV. > > I don't follow, sorry. I don't understand what you mean by "go through > at least one more level of indirection" here. Could you explain with > an example. Let's say I'm looking at this code: (defcustom save-some-buffers-default-predicate nil ...) (unless pred (setq pred save-some-buffers-default-predicate)) (if pred DO-SOMETHING) Here I know immediately what happens when PRED is nil and save-some-buffers-default-predicate is at its default value. By contrast, this: (defcustom save-some-buffers-default-predicate #'some-func ...) (if save-some-buffers-default-predicate DO-SOMETHING) requires me to go and look at some-func, which is "one more level of indirection".