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: Code for cond* Date: Wed, 24 Jan 2024 13:52:30 +0000 Message-ID: References: <874jf3rkzx.fsf@yahoo.com> <87le8ehqew.fsf@localhost> <87zfwurjv4.fsf@yahoo.com> <87cytqhn35.fsf@localhost> 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="34917"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Po Lu , Stefan Kangas , rms@gnu.org, acorallo@gnu.org, emacs-devel@gnu.org, monnier@iro.umontreal.ca, eliz@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 24 14:54:03 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 1rSdha-0008po-Jx for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Jan 2024 14:54:02 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSdgl-0007V7-V2; Wed, 24 Jan 2024 08:53:13 -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 1rSdgO-0007Sw-Ma for emacs-devel@gnu.org; Wed, 24 Jan 2024 08:52:51 -0500 Original-Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSdgN-0005C5-1a; Wed, 24 Jan 2024 08:52:48 -0500 Original-Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2cd04078ebeso63936261fa.1; Wed, 24 Jan 2024 05:52:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706104362; x=1706709162; 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=RJbtYvZUkrczJnj+sHvvkga9PDvSGv9hEiRcKbtruNM=; b=nU+lt9A1KR333ySJlsJAYqhZY0NugbqZixw2WRG+h0Qew4n1S9eaQTkc5FXR7WWvHR zBrpcYzJQrkdOLrp0VQ4vFLbbUaMM+3WTXqNdAqZqhHgTZXDL8g9NqiNRZbLgqXhJ9/p cOL2rM6gdg/gVgBJNky7odWfQ3tLN/3Xu7JqfDaTHBY5KIPD5hcpMZ3cHtIXQ0T5ZMxU WJ4xq9YhOpPAVb6Q1qJqqQi7NZuIPlVyyfJO14i3qtMCaOZ1uAWPBluK635d0fUQRLjK 4O+vR60TXrfbhbq496uW8AydjITADe0gQuWcjAQlk45YPesJB+DOFNEDnHFOT8ZV4cgs N7lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706104362; x=1706709162; 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=RJbtYvZUkrczJnj+sHvvkga9PDvSGv9hEiRcKbtruNM=; b=GqL4dqqtSx/SHzIk0WN7vH36hsir+e2afX/0CaJusScApFZrtbWkEmodHUmnEm5HnJ aUxEK7leslLwqEY7t9xHgd30RHv9Up7SIra2gmnVMuVMUB71NDVcLgKYCW7lo84m462n JAzW1uCAQ+18jQtpFQ4cP3LBlTVcFwG8OriBK5jGgTxQtYvx/+t1l8S+/VHzqXLwpVUo r1qukH1JoD4X1kqcJR1dDRv7ZvtHp+udSWGtOcSZTykbWFvFJRVecba/dmjEWRXMmpAX 96XcMUKzhixtlR7Nj95T+0vvVlJWia6ZMgc7sqVOW8ggA2XPcVoz8zKhWpbr4idguRAj 8lrQ== X-Gm-Message-State: AOJu0Yyv28DKQEorHUg6/Bg0w0rOFErF/PoQYv+GgBw0nim5d7ACxiOd HATPZXyRY4TzjY6UmYiMefsCEPtc1cPB0grSZvfcrJdh7Qukn7V7WhaU5nzG5gxqUR4XIfU82XG 1WdW6w3YFsI6M05V9I1pSy6XK39U= X-Google-Smtp-Source: AGHT+IHdqeGji+Z1CbXD4oPje89hfnc14CDgpysA3LpLvwley4fe2QLg6Su+mVY8Q9cwcB4A9SJbZdolMd66HBz50qI= X-Received: by 2002:a19:e01a:0:b0:50e:78f4:1e with SMTP id x26-20020a19e01a000000b0050e78f4001emr889100lfg.32.1706104362170; Wed, 24 Jan 2024 05:52:42 -0800 (PST) In-Reply-To: <87cytqhn35.fsf@localhost> Received-SPF: pass client-ip=2a00:1450:4864:20::236; envelope-from=joaotavora@gmail.com; helo=mail-lj1-x236.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-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:315304 Archived-At: On Wed, Jan 24, 2024 at 1:30=E2=80=AFPM Ihor Radchenko wrote: > > Po Lu writes: > > >>> (let (x y z) > >>> (cond ((eq (setq x ...) 'bar) > >>> yyy) > >>> ((setq y (... x)) > >>> zzz) > >>> ...and so on > >>> > >>> This alone is too important a feature to be consigned to ELPA. > >> > >> May you elaborate how cond* helps simplifying the above example? > > > > It will be possible for a clause to bind variables accessible in > > subsequent ones, eliminating the let and setq forms. > > The problem is that cond* is doing much more than just introducing > fall-through bindings. > > If we just need fall-through bindings, I'd argue that we should better > introduce them separately; maybe even as a part of the normal `cond'. Aren't fallthrough bindings just a code smell, anyway? I mean, I've used that 'setq' pattern in the past, but my intention is _never_ to get fallthrough, but to delay a potentially expensive calculation to just the point where it becomes useful for a single clause. I could easily use pcase for that, and the bindings would be local to that clause. If I need more clauses, I should do a sub-cond, or sub-pcase. That is the way IMHO. Code-smell or not, it is nevertheless bizarre or at least unhealthy -- multiple people have pointed that out -- that the new cond* fall-through bindings don't lexically wrap their users. Jo=C3=A3o