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: Tue, 30 Jan 2024 08:58:39 +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="9700"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 30 12:51:41 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 1rUmeT-0002Ms-4T for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Jan 2024 12:51:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUmde-0003v0-VY; Tue, 30 Jan 2024 06:50:51 -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 1rUjxA-0006hf-Cb for emacs-devel@gnu.org; Tue, 30 Jan 2024 03:58:48 -0500 Original-Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUjx8-0000U3-Op for emacs-devel@gnu.org; Tue, 30 Jan 2024 03:58:48 -0500 Original-Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-511203459adso36857e87.1 for ; Tue, 30 Jan 2024 00:58:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706605125; x=1707209925; 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=0Kt9rCU29+TLZh5LLQ7Uaa/z7vZbnKjx8ACc0qH9cWs=; b=FnjHUHelrjX6oyUjHy6jON7JBpSZY31M4+8BFekMEfd5az1+HQrmAqcSixZ/h7NlSE XNf/a22GW5pTgE3GassR8R3J4zeGjckH+ePO3ZvbsU9FCzbVvYKj/PPwSXeFjfStrYPD 9gCQfQEjtBdvAvSYLU6Z/X/k4rk8ehRGsJfyx6SZq2XsCQoSEmwmc//RB07peE/8+Bvw NSrVhNpAlDXZvNfdP5ACOiVbEgFpTr2mzGakIlZ2ML2U94X3WHYckiolxEEcJ0iMkTlC uJivC3bj5eVCaZYRN499U67qLeXEs/5jxGaTJ6ko+c1dRCx0u54e+jJVj7R8EeErFdAj gmtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706605125; x=1707209925; 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=0Kt9rCU29+TLZh5LLQ7Uaa/z7vZbnKjx8ACc0qH9cWs=; b=pmZ9xBPhFo3KcKY7pjkC1X6vIBJX8Ulo9CYAF6PxkpC3G4e7sBAix9TNuIN+bo4o2E oV4lHurWaBRMFgsO2Q1nLmIAzA9+z6NcJkft+/hpA9lJOxi09SUzuTXkkVixLGVI9W7a jr3fAKF+x3Lub6VooaeZN4AswbcLgV/SA8OvBEZ6+ptlvCEVPqgayPbkr1Zij14/f+St MbESPsMjWYwVXAD0xCTQu5qtjOVwlt0Lk7vv2OxvGe2TU+nFrLFlK4HInLRLjX5Czbm1 GLaqfFbtz918mpsq+uoW9c6bOqW7c8ekvOIE3/Rmqyq5Mq8lO5gEXfjpi7yCBFbr+uQS GCFA== X-Gm-Message-State: AOJu0YwJ4TaYBJ5o1SIrGSxJuMKDLUq30Fvcxb4/PxqsKwYGNGxmZOg5 v74Ovwb0NuVw9fLrf/xfob+lXuO8MuX0goodBVpUR4NK2a9XWVLTZY8dFCtm1jvRRpE7pVpHg15 RBTEfVdiwLCCeH8GLuq11I3RdbAOSdXaLB9E= X-Google-Smtp-Source: AGHT+IH+zb4vUqRXi5xNtWxedEV5iIhYrU0EOvsfBbWYaumaHLPodPmOX2PZvgT2xX+IJlk6meFY0n17XbEw7xwfD+Y= X-Received: by 2002:a05:6512:200f:b0:511:1eb5:2271 with SMTP id a15-20020a056512200f00b005111eb52271mr390306lfb.63.1706605124569; Tue, 30 Jan 2024 00:58:44 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=joaotavora@gmail.com; helo=mail-lf1-x135.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-Mailman-Approved-At: Tue, 30 Jan 2024 06:50:50 -0500 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:315633 Archived-At: On Mon, Jan 29, 2024 at 8:00=E2=80=AFPM Stefan Monnier wrote: > The patch I sent doesn't change `functionp`, but indeed makes way for > such a change (and changing `functionp` is the driving force behind it). I've now briefly checked Common Lisp land. Allegro CL is the only one approaching Elisp's level of salad. But at least functionp does what you want it to do. CL-USER> (funcall (list 'lambda nil 42)) 42 (6 bits, #x2a, #o52, #b101010) CL-USER> (functionp (list 'lambda nil 42)) NIL 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)) ? > > Alright. I wouldn't be surprised if I wasn't passing lists as lambdas > > around in that extension. I used to do that, and saw many fall prety > > to this, when their lisps allow it. The result is harder to debug code > > and harder to instrument. > > I suspect all long-time Lispers have committed such sins at some point. > I'm to blame for the godawful `vc-exec-after` example I sent earlier toda= y. I'd guess that's another class of blunder. Confusion about how lists and lambda work is much more common in newcomers. You can't forbid (funcall (list 'lambda)) without breaking lots of user code, but do sth like coopt the existing "lexical-binding" variable to introduce a JS-like "strict mode". I'm betting there's a correlation between files with lexical-binding=3Dnil and where these funcalls are attempted or encouraged. That's if you're interested in fixing this bit at all, which you don't seem to be. Jo=C3=A3o