From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: cond* vs pcase Date: Mon, 05 Feb 2024 15:30:57 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39739"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Feb 05 16:08:33 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 1rX0aG-000A7g-GB for ged-emacs-devel@m.gmane-mx.org; Mon, 05 Feb 2024 16:08:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rX0Zw-0000H6-BJ; Mon, 05 Feb 2024 10:08:12 -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 1rX050-0007E7-8K for emacs-devel@gnu.org; Mon, 05 Feb 2024 09:36:14 -0500 Original-Received: from mail-db8eur05olkn20813.outbound.protection.outlook.com ([2a01:111:f400:7e1a::813] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rX04t-0005Ka-S8 for emacs-devel@gnu.org; Mon, 05 Feb 2024 09:36:11 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eWk7I/rnOzSqkIFM/ri6mB/n2JU+qGTvJpPFoNnYA3sh3yH4q1pAbAgL9LbmS61wy1Z9lA9GumavUClC9DHYrqdknom1KkdMX7NnTg+drxbeG70yYfWtBjZrI9KUPChSlkk14Hw7eUDaRWdNQ5QLH/QGsC8sogvJSXVybmq53rZaJUD+Zts15RiO4L7eFzPvIeg5FIurO3UTkLoYgoijnCf+UdNnnAZggx/kyXU2nHBNJ8NRt15BK9p0P1F4v2lxW+alWTZkw0UPW5ds3Ah0xngC4e9HTqwrbbyYOaZTPJxY5FDFfz3KNc7cr5KY6NQpsnbmVRvN/+ihWlsdv+HEGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RHiofzaVu3X9MO4l4o1o89A5hG5sgB+213AimcDKXvM=; b=jEoPhs/xPVHeiERj47IHUWSz2BmiLe7NGuxyRowPRRZlHX9unclFk6a/Clbx5t0XSxQ1PTACBeRAA8/PlpM0scMc9R2JjTtow5Oq6OLvnXstJTWhTnZil/NRXPMTkByYvcJpv5amOv5k4g9jpCbwQji1ruKTql13963a8gjmRrpWY0d8zsloUp99AFvHQd+GAEsuFBrcMUv7oNvFBdwhmBpw8f2zAMYVCQvrD9fdXyPo/DGBVSdDBtSyaGSRacxuNwzcmqAzICWW+rBOJx1B2w/dPoeZMrcpM/nRTKjIt9ulipDksTkjxXbHRaTcCNhG8I+VS6AB65MlEFMIr8XDyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RHiofzaVu3X9MO4l4o1o89A5hG5sgB+213AimcDKXvM=; b=hADpsxkfrRWFwntD/OTEFleN4H3wy46X1p0Ty0Nh6LgCQ7FEisvD9ajzHbG7DPudBKJGpm8bmdaN0DMkwoUPaXRZYMgrZRurwInkdTBRqyhA5wVZdYrGHhra5J6QXwrh+efeYD5i1RDnER9Jdq287B42fhacAW7jeCAxu5OnjxozzDD7lY0DUPmFFWBv0ym+hi/3MvpUw9EFtPgqMN2/wP0t3uvUct5PzVSZdozgE7yAAhygAl5nsrsPhWgy432C7JoI44DUBQwW2fMQacP/kCEypsIROp6mGLtFnEPNEOeQzAXbpucsDztNoWN+eCGqDVq/VeVzeVZapecioloInw== Original-Received: from DU2PR02MB10109.eurprd02.prod.outlook.com (2603:10a6:10:497::14) by DU0PR02MB9539.eurprd02.prod.outlook.com (2603:10a6:10:41f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.34; Mon, 5 Feb 2024 14:31:00 +0000 Original-Received: from DU2PR02MB10109.eurprd02.prod.outlook.com ([fe80::b91:5e3:fb4a:3b2c]) by DU2PR02MB10109.eurprd02.prod.outlook.com ([fe80::b91:5e3:fb4a:3b2c%3]) with mapi id 15.20.7249.032; Mon, 5 Feb 2024 14:31:00 +0000 X-TMN: [7i16LbkcbUOAFcqxxSFAu0Q+I3bp5bhUeBnLFJtyQSo=] X-ClientProxiedBy: MM0P280CA0073.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:8::23) To DU2PR02MB10109.eurprd02.prod.outlook.com (2603:10a6:10:497::14) X-Microsoft-Original-Message-ID: <87plxbx9su.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR02MB10109:EE_|DU0PR02MB9539:EE_ X-MS-Office365-Filtering-Correlation-Id: fe9e6100-e862-4c47-8797-08dc265712a7 X-MS-Exchange-SLBlob-MailProps: Vs63Iqe4sQkBq0laDhFs4OcxlHNNz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lo1WwYsGn9QI3PqVxwOAW1xPb0svCs5HJampToRhDdOrMHtcGmUa6vo0g6RRqeHgmTAiwZ4ubDr9xSx0NQBfi44/LC2IxPuRumk+HKT9syAwUthWa7rCHvQHStlXQMIfVUBZmxeF0Xj7MC9sL2s1ca6IAIi9fJKqxaYACNlFig4IojPmY3UzvsK4epK9uZQMHrf4toHIlm99s4Tm7eIq8s249iaUB2pU= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CYyPUplK5664mZzQWF9CgYK/3Wq3O4FM188H/Hf92rAtjME5rdfnDxVEay9G?= =?us-ascii?Q?1FwhuJwonCOz07QF8PD2TcM3MzmvG37ub9ZjQA7WVabS0OOQVMkBSK33M9nx?= =?us-ascii?Q?3By/WCXrEse+WUrV9y2+Q/X1JR/PHytbMEdIkV9hmXJ59o7S13qfDrUiZ0a7?= =?us-ascii?Q?InOoqKutqdwr/zb54wQI1BrrjiEHg97hd8f17x6jQzIzo1e6JWzZTmCmTgK+?= =?us-ascii?Q?GsDRO+oACgB7M9RvieA3SHFjN/HZ6lOrO42dFrlwk+ONHTvIANXYOFsRUvjl?= =?us-ascii?Q?akV2wQkHkv9/9wGFZgOX8gWb8MbTO0ovMtJEFGfppJ8kV9CCuFoL7NzMSSCo?= =?us-ascii?Q?vJZjqxwDFKhhYaDmKT+xJGY2/x1tSb3OFYlVxS9Q2n/sVRiWjmQDrim6Ik22?= =?us-ascii?Q?4tVEBPV/+tndo/Qrps08eSYNq12UDcbHJH/5nYBWFIgNGJYnjnpmfk2E0dNZ?= =?us-ascii?Q?bq6HuKiHPfzFGjyOdz8aJGuHZSbr5RJRR8Q78xlesa9MY3S4Thu2hoc3LKNt?= =?us-ascii?Q?sj5oVli8hd38XcdUtGmm3RjB7NsKGEFuLh+oObD1DYVCdS+zNtvFdAycuiTi?= =?us-ascii?Q?24r+QA2K4hv5URuI6EyvLt8tZNgSNEIV4cAN2HdWjHofsbl4N6fccqomN8Nk?= =?us-ascii?Q?3s X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-ab7de.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: fe9e6100-e862-4c47-8797-08dc265712a7 X-MS-Exchange-CrossTenant-AuthSource: DU2PR02MB10109.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2024 14:31:00.1395 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR02MB9539 Received-SPF: pass client-ip=2a01:111:f400:7e1a::813; envelope-from=arthur.miller@live.com; helo=EUR05-DB8-obe.outbound.protection.outlook.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, SPF_HELO_PASS=-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: Mon, 05 Feb 2024 10:08:07 -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:315895 Archived-At: After skimming through the toms of the emacs-devel, here is what I got: RMS does not like pcase; it is hard to understand and under-documented, which is actually true, at least for the latter. To remedy, you are re-invent the idea with a different syntax. I have been hanging on /r/Emacs for a few years now, and here is my prediction of a future hypothetical Emacs Lisp learner asking on /r/Emacs: "Which should I use? Pcase or cond*? Which one do you recommend?" And hypotetical future answers: *Toms of similar discussions similar to the one on this mailing list going on for days, but in Reddit comments, suggestions in different directions, and more confusion.* To start with, I think none on this mailing list has asked this question yet (or have I missed it?): why does it have to be a single form that does all of the pattern stuff? I use pcase often; but I use it just as a better cond. For example I find this handy: (defvar foo nil) <-- foo is some symbol (pcase foo ('bar (do-some-bar-stuff)) ('baz (do-some-baz-fluff))) or this: (setq foo "some-string") (pcase foo ("foo" (do-foo-case)) ("bar" (do-bar-case))) I don't use much of pred stuff and other advancements. I probably never will; there are other ways to structure the code. Not everything has to be done by one and the same form, but if someone else does, power to them, I have nothing against it. For the same reason I also use cl-loop very sparingly (I almost never feel need to reach for it in my own code). I think "while", "dotimes" and "dolist" tells me much better the intention of my loop and what I wanted to do, than looking at cl-loop and deciphering if it is a while-loop, an iteration through a collection or a repeat loop. For the same reason, in Common Lisp, I don't try to write the entire programs with Common Lisp format directives, nor do I try to write entire programs with a single regular expression as some people seems to prefer. That makes code ugly and difficult to read; I prefer to structure the code with simpler Lisp statements. Why this obsession that we have to have one form, be it pcase or cond*, that covers all cases of pattern usage in conditions? My second objection is, as many other stated here; if pcase is that hard, resource heavy, and underdocumented, have you considred working to fix problems and on the documentation of pcase, perhaps with Stefan? Is it possible to simplify pcase in some places? You could have maybe worked on pcase to make it easier to use? Could pcase be refactored so that parts of it are loaded into the core and used in Emacs core, and some constructs are made available only after user requires an extra library? If it is too resource demanding and macro expansions are a problem, is it possible to perhaps pre-load parts of pcase implemented in only primitives exported from the C runtime? Instead of working together with Stefan to make pcase and Emacs Lisp a better and easier language to use and learn, cond* is pushing out the worst of all ideas: implementing yet-another pattern language and adding even more cognitive load to an already arcane implementation of a Lisp language. Now Alan will have to learn *two* pattern languages to debug Emacs instead of one, because pcase is not going away. It will stay with us as long a Emacs lives, just like all other Elisp constructs, unless you want to invalidate or rewrite all third-party code out there, which is thousands of packages by now. I am not a best writer and diplomat, but this link summarizes what I percieve what pcase is trying to do, and cond* is just adding more of the same to it: https://xkcd.com/927/ I understand the objections to pcase, but I don't understand the answer. Best regards /arthur