From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.devel Subject: Re: pcase bindings in patterns with complicated logic Date: Sun, 14 Jan 2024 15:58:56 +0000 Message-ID: <87r0ijj48v.fsf@posteo.net> References: <87il3xt38w.fsf@localhost> <875xzwjta2.fsf@posteo.net> <878r4rsyyt.fsf@localhost> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3625"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rms@gnu.org, emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 14 16:59:46 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 1rP2tj-0000fs-DW for ged-emacs-devel@m.gmane-mx.org; Sun, 14 Jan 2024 16:59:43 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rP2tI-0005PS-Ek; Sun, 14 Jan 2024 10:59:16 -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 1rP2tF-0005OE-Vz for emacs-devel@gnu.org; Sun, 14 Jan 2024 10:59:14 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rP2tA-0003eI-7L for emacs-devel@gnu.org; Sun, 14 Jan 2024 10:59:11 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 8C7C2240105 for ; Sun, 14 Jan 2024 16:59:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1705247943; bh=iaagGJMUIbNlNKdTpCqnuT7t00iOgJKG+48EAcPD5Os=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Autocrypt:OpenPGP: From; b=QyC2/Ugbo2EwQXMP/Ow6slhujIFnxOdh9OTOXLORy9w4Bnlic65iuiisfGUA4vZSI ex9AH4u3Mpe6GDuUZVjG6aU6TJUiptJJNDR4MmEE84P0IcoVz3ieA8KXWSFBU+oxQh Oqr6c+Lw2EIVNlMUFCDfo5XdGlTwPvQhVhvv/JLqOwv35E7sw0ZQOibeZ41wtHAs95 3Or4R4qecs0c+nt43gSqGjYy5JeiSTymIcLpdssO5B6mSIcsielbbwhUNhZLfl8jG8 KBnRGt+BtUUrGa7TxutizGlo1Mra63VRDsDaCKCUE8jI0tBv8g1HEn5cnwkFl4yuc3 4/84ouqlmU4KQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TCg1d5vFyz9rxN; Sun, 14 Jan 2024 16:59:01 +0100 (CET) In-Reply-To: <878r4rsyyt.fsf@localhost> (Ihor Radchenko's message of "Sun, 14 Jan 2024 15:42:50 +0000") Autocrypt: addr=thievol@posteo.net; prefer-encrypt=mutual; keydata=xsDNBF8ylcIBDADG+hy+zR6L4/vbdDDZuSaMmSrU3A5QZJpeBCvxTr7MpzzruZbhLPW1K3R6N2MA edi8Y+C8o27FVRIjpdbaKMGu9je7JV/TbUQYo3SOwCK1vM4LUn4V6ZLzSYkuiEt4eyMoiDdyvN0p kcK6P9x9DCetcEVszXzQg+yzCVrQ2hXWDXWT4M18EC3wtO7RHPouMqGiwBFhBAYErCqFWFxQHkfb tG/4yGyJ58rglb65O3qijjMWvYwcWZun9/7qm8Z4/4mHopmo2zgU+OrptnLSZfkZGz3Y7Uf452xQ GVq0Fv75NPvQru7y+DYVhuVXXyAmGxt+vf4rIiixMBbhKEPjcxEPAa2LTzex2IsTZR+QVG9uDnqC WcgaOEQ58fzXNvNhtwwF/Rgio2XWAJVdmFWS59/k9W58CIUSNKBMZh2XeGdEmtHvDtCxW3z6FJha 36RzOM3fMNNiAGdFZJA84gcdloJR+sHCDTTPT3784fjr+V8An7sI581NGFzkRQqPvEQCZbUAEQEA Ac0SdGhpZXZvbEBwb3N0ZW8ubmV0wsEOBBMBCgA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA FiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmL3HCoACgkQDsVtFB0W75OVEAv/f6XxmtIFz08fUb8h Bp/zJP6IC4/rhhh+0GMRIRzLN8DK0jV8JCzYdFHiRJOy2lNIOpmrrCmjRRxferc2G42+ePFIsslx hU46VSz1Z83NwIG3mpdYNV5WUTUdgzxExHTNTFCd7NKv0nlHKQaA OpenPGP: url=https://posteo.de/keys/thievol@posteo.net.asc; preference=encrypt Received-SPF: pass client-ip=185.67.36.66; envelope-from=thievol@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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:314967 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ihor Radchenko writes: > Thierry Volpiatto writes: > >> [ BTW I don't understand why `app` pattern exists as long as now `pred` = is >> supporting an extra arg ] > > Isn't it explained right in the manual? > > =E2=80=98(app FUNCTION PATTERN)=E2=80=99 > Matches if FUNCTION called on EXPVAL returns a value that matches > PATTERN. FUNCTION can take one of the forms described for =E2=80=98= pred=E2=80=99, > above. Unlike =E2=80=98pred=E2=80=99, however, =E2=80=98app=E2=80= =99 tests the result against > PATTERN, rather than against a boolean truth value. Perhaps it is right but I don't understand it, an example in the manual would be welcome (if there is one I missed it). >> Also I would give a warning to extensions developers that want >> compatibility with older emacs: >> >> pcase has evolved and doesn't behave as in older emacs, so try you pcase >> statements on each emacs you want to support, for example (pred (not >> ...)) is not supported in older Emacs. > > Compiler takes care about this warnings. For example, > (pcase '(1) > ((pred (not cdr)) "true")) > > in Emacs 26 will indicate problems > > Compiling file /tmp/test.el at Sun Jan 14 16:41:32 2024 > test.el:2:15:Warning: reference to free variable =E2=80=98cdr=E2=80=99 I already hit this warning and had hard time figuring what was wrong, in test.el it is easy to find but in a large file the compiler doesn't bring you always to the right place. =2D-=20 Thierry --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmWkBMATHHRoaWV2b2xA cG9zdGVvLm5ldAAKCRAOxW0UHRbvk10wDACuiP7DdW4gJ4wqVVAF+WQ7EednZYEu DSadQHqXvj0Uoi+5R+su8HkrIwQ7ngLKCCuffilBU1KyUU6YWrOkS6Y3EY4GS6LY 2BSLRooHR7FVmuQgUQF9suQVlmwxhIwR3twfIbOLvH/rWpBcvF3vvAhVJyL/SoqX pQLh2DxVj+ycUK/2cbhXzS5HHhWKWZvv+q6fhRPzNoLWRO5+bshCRNunRB3DwoSD RfbvEUUyewbspJuO9GK2I7y5UEzhRSGKNuDSCXvSm9UQyQLRX46W3YXFbOvZ/BKD ss9TBrJE/Y7gTBcQPdkbpX2bOyssv39CnoY8qoJZZGDEG+KWWBdEte8uYB7dEPJf 7NZNx28TjX9VRX+BqLuA1Q0tgDUKkPYWArYD1l6PPqy7grnpY9sGpSQfI9WgOpVV 1Q8t1BNi9bs7LLjGQe/fdaY1dJRme5HC8O5aAF1jHJ7a39oJmsgE0TbvFEpqFONy MB9vl+QnPkaR1ncBSsyUCTcxJxLaYpciS3U= =s77B -----END PGP SIGNATURE----- --=-=-=--