From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Distinguishing `consp` and `functionp` Date: Tue, 30 Jan 2024 07:54:55 -0500 Message-ID: References: <86msssble8.fsf@gnu.org> <86bk9448ai.fsf@gnu.org> <864jew40m3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38159"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: =?windows-1252?B?Sm/jbyBU4XZvcmE=?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 30 13:55:47 2024 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 1rUneT-0009cD-35 for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Jan 2024 13:55:45 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUndn-0008DX-Hj; Tue, 30 Jan 2024 07:55:05 -0500 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 1rUndl-0008DG-PF for emacs-devel@gnu.org; Tue, 30 Jan 2024 07:55:01 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUndk-0005oa-0J for emacs-devel@gnu.org; Tue, 30 Jan 2024 07:55:01 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C99951000DA; Tue, 30 Jan 2024 07:54:57 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1706619296; bh=nvOd6p/GZF52Lj5zUJ5W3aZGoOh7sJXV4K3Y8G+3UK0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pslEpgYikULqnz+78Tln+Cl651kYkJuQOhv2tZGou/vpNO56DNjS10nEruCwqakas G2GfGoXwce8z8bWuJIqMWbA37xbkCHaVbDSvefMNdhA1/FprnecNdfIdDwPLAUle4p TxbwXhIQu1OsyLUL333Ei0O4zp263cfpYnZkMBOSzaVgsOMCaGTA2nCXkdyd9s3Ofp AkAiA9Lo/y4wkohDAn3l+ER5iV3PTdJXlo1DEA/p6oxvibrG7g+LzmPJQxOiX0PRsy RgsJWBD5EQ/mp+7D06Ko6P960V82wtt15C5WdDW/vWmOgqcpCunLmQo94ncTPHqC6M u4rgz4/8QOHQQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C1AF5100054; Tue, 30 Jan 2024 07:54:56 -0500 (EST) Original-Received: from pastel (104-222-119-131.cpe.teksavvy.com [104.222.119.131]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 642E3120D21; Tue, 30 Jan 2024 07:54:56 -0500 (EST) In-Reply-To: (=?windows-1252?Q?=22Jo=E3o_T=E1vora=22's?= message of "Tue, 30 Jan 2024 08:58:39 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:315636 Archived-At: > CL-USER> (funcall (list 'lambda nil 42)) > 42 (6 bits, #x2a, #o52, #b101010) > CL-USER> (functionp (list 'lambda nil 42)) > NIL That matches where I'd like ELisp to be =F0=9F=99=82 > But then there's the common pattern in libraries: > > (let ((value (if (functionp user-visible-variable) > (funcall user-visible-variable) > user-visible-variable))) > ...) > > Won't this break a user's config containing: > > (setq user-visible-variable '(lambda () 42)) > > ? Yup. My impression is that this is sufficiently rare that we can afford to break it. Maybe experience will show me wrong, of course. We could also consider an intermediate step where `functionp` returns t but emits a warning. > You can't forbid (funcall (list 'lambda)) without breaking lots of > user code, That's my impression, indeed. > That's if you're interested in fixing this bit at all, which you don't > seem to be. I don't see very much benefit from forbidding (funcall (list 'lambda)), indeed. From a purely philosophical point of view, I agree that it should not be accepted, but in practice the only downsides I can see are: - it can give a wrong impression to a beginner, encouraging confusion. - it can occasionally hide an error, making debugging a bit more difficult. These seem very marginal to me. Stefan