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 22:24: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="36391"; 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 Wed Jan 31 04:22: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 1rV1BR-0009Ex-9k for ged-emacs-devel@m.gmane-mx.org; Wed, 31 Jan 2024 04:22:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rV1Ah-0003zv-Td; Tue, 30 Jan 2024 22:21:55 -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 1rUwXA-0008RX-BY for emacs-devel@gnu.org; Tue, 30 Jan 2024 17:24:48 -0500 Original-Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUwX8-000383-ON for emacs-devel@gnu.org; Tue, 30 Jan 2024 17:24:48 -0500 Original-Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2d057b6ddfdso16968691fa.2 for ; Tue, 30 Jan 2024 14:24:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706653484; x=1707258284; 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=HGUYAqnzRV2qGdefGexjb8FXPP2YLrc4JQGuH0iS5G0=; b=kwBZqjF+0eS92mm3tZ5SkDZualoKqcS5eyxtZ2Il9HO+wYgsNS/Gzr8ndevpsB+Dgl SFF7q5jy5h4hLXIkLyTVFOmcEu3q3yvcOn4I1u/z12gEE9hvGbEMZHurygfTaTQIbNpo RHyiiw5punmfx/3d7fsnV5lbiS+jjP24E7qdLg3afFZJEjwJG5hY8DrIOuYnDbaB96ez AyQ7I0RWvOPiu/9l7/zHc5A28TH8attEsA1c3aKdxyBlkowZ20NUhmk1jnO07/171gOi crIviOxzOIfxLS5kfiN9Rmz6IsrI77QVM7qGFkbzUc8QDqWmHpo2462mUSiXWVBjSG1F x/Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706653484; x=1707258284; 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=HGUYAqnzRV2qGdefGexjb8FXPP2YLrc4JQGuH0iS5G0=; b=RyJAP48TGO8q99C/61psmXVBZxshfFNKx8dHul8pCYrU5MWNoOGD1zYXPWGluvN5bp F2fRUxF07wPfKR/Ky+Eg0VKppyXlTqrXmW1Q4XsnrOFwUeCO6dfCcO3yfObq4Dycntrj jlo2ZHUJYvZmzOhrgm8LBRdo5Ras2NvRJXZUQi3+8c4Wfv751bTsP1dI5gadDCYQK/y4 LRj0NJ5rb5mj3lg+zTtzmQlm72NO4d15lqf7Pg9K01u4pBmllrSFYz4bleu5zsQ3HHYv qK+bx6YYMOaZlQ+9XXfSfOFJPLUTxlB7UEvrMyRxI9jHe9ifoMEjM3bJDxR0k2rwvBG5 jFhQ== X-Gm-Message-State: AOJu0Yxzys1anNpBxDIl/WSmmBSsdfuuvUeS6oRu+VubByneJPqx2jjW r1yL+Rze0yix/LYEC10DtiQADVCBNGOeaV7AJVv+HcNeTQexVDyqgfxLUlbhIJw13zYD23wW5mw UIjtA5Ff7DOuaVM+AZcMKyv7KJN/unYqN3eg= X-Google-Smtp-Source: AGHT+IFqhsyPi5HbEaq0wjhQmeUu9siLZWfcRtphv2KZ4axOAbCrRB81tBw5MaI7af+0T+VKZSgtAfZrTi67THWA8/E= X-Received: by 2002:a2e:9886:0:b0:2cd:10be:cf14 with SMTP id b6-20020a2e9886000000b002cd10becf14mr6532851ljj.19.1706653484387; Tue, 30 Jan 2024 14:24:44 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::22c; envelope-from=joaotavora@gmail.com; helo=mail-lj1-x22c.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 22:21:54 -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:315648 Archived-At: On Tue, Jan 30, 2024 at 12:54=E2=80=AFPM Stefan Monnier wrote: > Yup. My impression is that this is sufficiently rare that we can afford > to break it. Maybe experience will show me wrong, of course. I've definitely seen users post configs to Eglot's bug tracker where lambdas appear incorrectly quoted. i.e. (add-to-list 'eglot-server-programs '(foo-mode . (lambda (..) ...))) I try to always correct them, but sometimes it'll just silently work until= it doesn't. > We could also consider an intermediate step where `functionp` returns > t but emits a warning. Indeed, though in that case I'd make the funcall warn. I think it's there that this proposed runtime warning ultimately matters and is useful to help users correct their elisp. Runtime warnings are a bit icky though :-| but better than nothing. > - it can give a wrong impression to a beginner, encouraging confusion. > - it can occasionally hide an error, making debugging a bit more difficul= t. Wouldn't you add "complicates type propagation, static analysis and optimization" to that list? > These seem very marginal to me. I've definitely seen this error happen more than once: (defun call-with-oopsie (fn) (funcall fn)) (defmacro with-oopsie (_nil &rest body) ;; usually some much more complicated hairy expansion `(call-with-oopsie '(lambda () ,@body))) (defvar x 42) (with-oopsie () (+ 42 x)) ;; 84, everything's fine, my macro is great (let ((y 42)) (with-oopsie () (+ 42 y))) ;; oopsie... The warning would have made the first call work but signal something is off. Jo=C3=A3o