From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Distinguishing `consp` and `functionp` Date: Mon, 29 Jan 2024 15:54:04 +0000 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="17936"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 29 16:55:13 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 1rUTyb-0004OV-5z for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Jan 2024 16:55:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUTxp-0001My-JF; Mon, 29 Jan 2024 10:54:25 -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 1rUTxk-0001MJ-HC for emacs-devel@gnu.org; Mon, 29 Jan 2024 10:54:21 -0500 Original-Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUTxi-00075X-TG; Mon, 29 Jan 2024 10:54:20 -0500 Original-Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-510322d5363so2627913e87.1; Mon, 29 Jan 2024 07:54:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706543656; x=1707148456; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zCvPPGoXu7Rs55t+MWgG9H/ilxiDz/aYtTZtjYK7CrY=; b=FsNMNPdz9r2s7ZhC3i5uzh4LgkTbzoIr0O4BYgJ/2E7wpfm2L5OfrP31GdrnsA+ThF KxtQzKWRmFPWI989WWWn3Iy3TuJ7Bki2a8O5V9snV2om1XJf8HleWUA8pkQmvv6wg4Hl o1smrEo1Adwkodhc9DZn4gT3zZ+w7pyDLe9x3fa+6yFH6nMJwCwQ1QKERKvrfY/NlHAC 6U3R0I6eOm5rFMzLwkDVAX7guzdmX6WW2yCxHN6chc8qsAsxlwQQmr2XdlmCvp+jmL+/ +H751nlpd2PZeJZqk3bB3EiDdSR0ftyF14Ndo8jLnB/DXrdr1zFfzAy0KxddOKM6v3Xd Khyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706543656; x=1707148456; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zCvPPGoXu7Rs55t+MWgG9H/ilxiDz/aYtTZtjYK7CrY=; b=f5UUujwp1o/bcvIbaet6p3YzHad6abhpAjnwF62sfFp/o7c3WWAYXqkM4enw9z/nTI nv6f6dqodUomSWuJAqoEjQGq9U4WXDnuLJeh3KT8RaX/H5jkIWKOIyDcW3FGL7ucXP/H le5pkiB5uG9IKTaIFhYsxRXhIV8LbBe9DA2fumQN7XWUdTrYr22HVAS6sCHaEJ2rV/0O +FQUp8QQnLdCZ/Uu8OB32v3RkVX1Q9MHCPvmLnzmKQUlf8YPmuik6T79Fe0eHZxkj4EP 4aoXg4mS6EhpgECjVMtreurt/ytFcN7WHFSpNZrnDaHcbsQ53OW5xRiM4GRiOthg/CpV QsPA== X-Gm-Message-State: AOJu0YyERRflaconNoDw33HeNxGMrPx9iuFNDSA2PdWTvcwWhoSJeI6O OgKbhPg8KLHbo4zS8LL6QGF9TrT533Sc0XJxQwJpbF7+EfCL3VJGEh9hwQtw/9drlIQ5ByNdyCO lan2/HyBW+9Y/Wbr3OUHXC6dnYjs= X-Google-Smtp-Source: AGHT+IG6UVHdxcIxfPH9tdNEq2wHxO3e/49Hp+R39a8KLkwhYLK5o3ekyde2cwp/0Gn2NfHR/pnIYq73EJtg5Wp+Oaw= X-Received: by 2002:ac2:47f8:0:b0:510:153a:6bdc with SMTP id b24-20020ac247f8000000b00510153a6bdcmr3617936lfp.19.1706543656140; Mon, 29 Jan 2024 07:54:16 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=joaotavora@gmail.com; helo=mail-lf1-x12e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:315596 Archived-At: On Mon, Jan 29, 2024 at 3:42=E2=80=AFPM Stefan Monnier wrote: > > > And the reason(s) you are "annoyed at the use of lists to represent > > function values" are?... IOW, what will we gain by using your changes > > in this matter? > > Beside taste and philosophical differences, the main motivation is to > make `consp` and `functionp` mutually exclusive so as to eliminate the > risk that a list be considered mistakenly as a function or vice versa. I don't think there is much space for philosophy or debate in noting for example, that a list as lambda won't get byte-compiled like a true lambda form. (byte-compile '(let ((bla (lambda () (+ 42 42)))) (funcall bla))) ;; -> (byte-code "\300\211 \207" [#[0 "\300\207" [84] 1]] 2) (byte-compile '(let ((bla '(lambda () (+ 42 42)))) (funcall bla)));; -> (byte-code "\300 \207" [(lambda nil (+ 42 42))] 1) > I mentioned that this risk of confusion is the reason why our completion > functions do not officially support completion tables represented as > lists of symbols (even though in practice they work fine (except when > the first symbol happens to be `lambda` or `closure`)). > > It also occurs in various other places where we want to allow either > a function or a list. > > E.g. a recent bugfix in YASnippet: > > commit 9228fd983bb9e71d44d406433a46495b22640801 > Author: Marten Lienen > Date: Mon Jan 22 11:08:44 2024 +0100 > > * yasnippel.el (yas-buffer-local-condition): Check functionp befo= re consp to allow closures > Yup, thank you very much for that. Stefan's patch moves us in the right direction if just for the guidance it gives to ignorant Lispers like the one who introduced that bug circa 200= 9. Jo=C3=A3o