From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Distinguishing `consp` and `functionp` Date: Sat, 27 Jan 2024 21:14:13 +0800 Message-ID: <87o7d6kjfe.fsf@yahoo.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28313"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jan 27 14:15:05 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 1rTiWW-00079A-Py for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Jan 2024 14:15:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTiVz-0003An-KM; Sat, 27 Jan 2024 08:14:31 -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 1rTiVy-0003Ab-BL for emacs-devel@gnu.org; Sat, 27 Jan 2024 08:14:30 -0500 Original-Received: from sonic305-21.consmr.mail.ne1.yahoo.com ([66.163.185.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rTiVw-000389-6k for emacs-devel@gnu.org; Sat, 27 Jan 2024 08:14:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1706361265; bh=ca0rh2yd3LJxd+MPbD489syub2jTZcaSkNMEJpnk0Rw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=Jn9V0v6dVpDGs74zkLCLLncPmcrzhgfNTSVBIBadO7+z/rB+qfj7braxgLpwUuHt62UQ13PXYi4THNUnlEnve2g1gVSGJySLFcf2OffZETdtldW/Q4cqLm4StcdfIuSyOBEEUqtFfE2Uh+hypaksvEPUtI487DUjO9LUu5nVcwg9wywWGbwK2bxbHRSEMj5ROZfLAy5W1ZS76QY8jqR6OGTykffvFr6LN1y8RvOjFNkFEKycnBJA+tn361eCSxZLeuNib9PHECkLFZSQz7kFDj8Qz2YIqpFj9Acb3M9gE/givQpZeo+du3/uvKOUD6kk3bAFZ+M3wVq8xqohappaHw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1706361265; bh=zt99qlnGWBDAjRbXM/UWRM6MnEk7Xdr/5k8FO7sDT9P=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=OXrwo4dOKY8ojr0aErE3/mMJ/L+n5hDi4P/vOWbWhAn+smMu4QJMhuN1yaRaJRidY78kRAZX/lur9mv9NUvtCjvwVEqYg2VeujSNyOmkgZZhAHVVLPbMqeEOjqJ8sKjWDPvSdqF3rTxeMyXigXyuBrbom9FHisPI/64STOXUA0PSdM1hUt1VFSu7M/bqjcXU7g34Idpkd1drUykjxGhSY3Mtvd5h5Pv9U5XF+qKNwGnZue6/7fGG/lFVxpdMYMqSrkNEJawHRnPmOwLKCXtiSGWUP8H+iSOzp+qgAHLXqUcGPzi4t+99zHOdimRg418a01LPWfJLr+040VK15Rpoqg== X-YMail-OSG: q_iCIXoVM1kure34eFKyuAZA0Rjg0jb0RaXySnsFvhrFHLtuO3DHGo80S9RGJv_ _Jz8wCBrpImrv9a3z1U5t37tDCKjwn8R78ppbeQC3Bd0_UdZEpLpe49nB1kO_k8zUoOek5MMlLMR wX6lEjOxO3Ed0Unqp69n.qDMGoyhujqUQQT5Kta0G1rTl54Z1ZlJJ1wFNyR0zmJK0RJFAQY2zvbB a.HIQ1O7A8qTXnH6raFi_OP8Ru0jFxtpVOxiSpFC8AsfpsFI7sPxOpiG4Fb1gEwqhzXuj9aDoypj 055uGqfKEOqoWq.LwrVsydBNi97RtU1rYxaZ_YFpl0B4EBWcQHUvhr6ZCVpvPskDw0rElxeAv8Q4 ZePYjxqmT4bV5Rc.8ESH2jEKi1w_cMWxtAvfYNXZgo9GbhrUWZEVxofsRjDNTk03B3kiKljGectR hXoFy4Mtm5wd_mBzAlCdDLzWk5yy5u8W9Ke_Rz7OaMGsSUgt5KTNAn20pbzPYITQRUe59f0B_Edv 5jKO_8NUYAyhLqS8XFKgMnqnMBcStP5EM94kaUIpvHpfvxrP3lRwVkHIEO2mki.NHB.ce9qUe5TG ipJq7iYvby3gRGUnmnYTCHe4dJK5SAk5u3ckkRC5wE210g5BsowN9FsCqHQIptFnsouQbzckT3lf 8gCoLBoxWCb9jmmeZJNZNom9jZABBP9mRZgXk6H8SbAEmqiTOO7CGTxGKfgIakH0f3Evd5.LW2Pb 9a_e2T8lDpL7JEL14gCY_2wbCxkSz6KpTKImws7p2ujuN5kInGYqS1ngHlwoJs98bkVl_CFrQ8hM EE64bJpjhiGj7MKmybvQUZY.9KapjSzJZHzjbPpbaT X-Sonic-MF: X-Sonic-ID: 1e225e0f-d1d7-467a-b984-8640833c8f4b Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Sat, 27 Jan 2024 13:14:25 +0000 Original-Received: by hermes--production-sg3-6dc75bc8fb-n9pfz (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 0ee7962e68e3e46b38089fc857a27fee; Sat, 27 Jan 2024 13:14:19 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Thu, 25 Jan 2024 18:15:48 -0500") X-Mailer: WebService/1.1.22046 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.185.147; envelope-from=luangruo@yahoo.com; helo=sonic305-21.consmr.mail.ne1.yahoo.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, RCVD_IN_MSPIKE_H2=-0.001, 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:315483 Archived-At: Stefan Monnier writes: > I've been annoyed at the use of lists to represent function values for > a while now. For a reason I cannot fathom, I even managed to reproduce > that very same mistake in Emacs-24 with the `(closure ...)` value for > statically scoped interpreted function values. > > That was a major blunder. > > In any case, I'm playing around with a "fix", making lambda evaluate > (when interpreted) not to (lambda ...) or (closure ...) but to > a self-evaluating value that can be more reliably distinguished. > In the patch below, I just reused the #[...] byte-code objects for that, > putting the function's body where the bytecode string goes and the > function's captured environment where the "constant vector" goes. > > It's got several rough edges (most importantly that > `byte-code-function-p` returns non-nil for interpreted function values), > but it seems to work OK so far. > > You can't use the patch as-is because it's written against my local > branch, with various local hacks, some of which (partly) remove support > for lexical-binding==nil. > But hopefully, it's readable enough for you to form an opinion. I'm fine with it, on the condition that it continues to be possible to print and read lambdas created by quoted function forms, as: #'(lambda () foo) Needless to say, funcall should continue to accept old list lambdas, whether functionp regards them as such or not.