From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#56875: 29.0.50; [PATCH] Add thread-as macro Date: Tue, 02 Aug 2022 14:56:02 +0200 Message-ID: <87pmhiolct.fsf@gmail.com> References: <87h72vq4eq.fsf@gmail.com> <877d3r0x22.fsf@gnus.org> <83fsie28i1.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="10803"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 56875@debbugs.gnu.org, Lars Ingebrigtsen To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 02 14:57:29 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1oIrSi-0002j1-Vz for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 02 Aug 2022 14:57:29 +0200 Original-Received: from localhost ([::1]:43456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIrSi-0003xl-2V for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 02 Aug 2022 08:57:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIrSI-0003rs-P9 for bug-gnu-emacs@gnu.org; Tue, 02 Aug 2022 08:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIrSI-00089b-23 for bug-gnu-emacs@gnu.org; Tue, 02 Aug 2022 08:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oIrSH-0003AS-UD for bug-gnu-emacs@gnu.org; Tue, 02 Aug 2022 08:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Aug 2022 12:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56875 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch moreinfo Original-Received: via spool by 56875-submit@debbugs.gnu.org id=B56875.165944497512107 (code B ref 56875); Tue, 02 Aug 2022 12:57:01 +0000 Original-Received: (at 56875) by debbugs.gnu.org; 2 Aug 2022 12:56:15 +0000 Original-Received: from localhost ([127.0.0.1]:42811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIrRW-00039B-GM for submit@debbugs.gnu.org; Tue, 02 Aug 2022 08:56:14 -0400 Original-Received: from mail-ej1-f49.google.com ([209.85.218.49]:45055) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIrRU-00038y-OQ for 56875@debbugs.gnu.org; Tue, 02 Aug 2022 08:56:13 -0400 Original-Received: by mail-ej1-f49.google.com with SMTP id ss3so25719690ejc.11 for <56875@debbugs.gnu.org>; Tue, 02 Aug 2022 05:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :user-agent:mime-version:content-transfer-encoding; bh=4RqfPxUPYZWTkzbtydyJM6oGu/vVs9+jOqZxw3INKyk=; b=LIywG1o9F3r49c/SYGpoNxUp18pUySwKm/+0PJWHmsYXeeS3b3vBemAgsbYlovyVs3 VPA08U+vnOXQOihho5w1vOQi/FBqzAhrdw2R5R7S2i3h/lthKXZIqw9pSeGmTB+3NObJ CJazLNDCmu4LrIjJTWvqc/oWyuto31xpZ04O0FrybM4VU3gSzLw8f7YqZlLvJrBSeB2W Whr9hqOB0GtClIrZ/UcwNWNVHzkwHK1h1A6OCcp8MFWaWDO3bFr4ufFmbnT7LBtKnNQQ /vCf4NeIHTAt8I6bHte4aP0yVLIAKBApEVpRKceUYCRQN0Q9z1LPNcJ5ifusdPS1aDCy TRAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:user-agent:mime-version:content-transfer-encoding; bh=4RqfPxUPYZWTkzbtydyJM6oGu/vVs9+jOqZxw3INKyk=; b=LchH/bOlwXiL5zamcyjOxD6oROB27uKD21cmRHZSv6zTMoz5vcSbf0eRTjOzQQBZqu johC8YQQflk0u4P0e1AT7Zzu3eSoyrknt/nsJVadVIIH1aNVrW74L5Rsuwb8aVqDYzLj oeZ2jF7VoZbQYOqjMMpfSn7OxcdXMg9GrcBbFbCcagt53bo+//JBjlQJEFImM06k7FUn n5us5tMIvjXm/XGy2DDaHW1C222cjIWFzmUkkezWSUUcYxc1eJQqcK7B+L3n9Z9T7YC0 eICr7JDwy6SV5KAWsB01HMkqzTH7jdEHRqutAmO0Yxuf60SBpvf01kRxTmVrl1YhCbRJ M6lg== X-Gm-Message-State: AJIora8GA82us13bovi6inz3zURY07/yWulaJYFbK3EOsDfkrkhzOdIx vZrBASC5fkQtiAFCbOK0HyixdTzYy3XFlA== X-Google-Smtp-Source: AGRyM1sHEA+vvpL5tMhpAlSmqPqqXYx8QOzsucP8xoO1u+tgHNkhaZy/Lf9XkxW8M+WzwrtltWa7ug== X-Received: by 2002:a17:906:fe0b:b0:730:3646:d177 with SMTP id wy11-20020a170906fe0b00b007303646d177mr14301417ejb.688.1659444966344; Tue, 02 Aug 2022 05:56:06 -0700 (PDT) Original-Received: from ars3 (pd95c95b0.dip0.t-ipconnect.de. [217.92.149.176]) by smtp.gmail.com with ESMTPSA id fl19-20020a1709072a9300b007052b183d51sm6167174ejc.132.2022.08.02.05.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 05:56:05 -0700 (PDT) In-Reply-To: <83fsie28i1.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 02 Aug 2022 14:24:38 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:238550 Archived-At: On Tue, 2 Aug 2022 at 14:24, Eli Zaretskii wrote: >> From: Lars Ingebrigtsen >> Cc: 56875@debbugs.gnu.org, "'Eli Zaretskii'" >> Date: Tue, 02 Aug 2022 12:17:09 +0200 >>=20 >> Augusto Stoffel writes: >>=20 >> > +(defmacro thread-as (var &rest forms) >> > + "Successively bind VAR to the result of evaluating each of the FORM= S. >> > +Return the last computed value. >> > + >> > +Example: >> > + (thread-as x >> > + 4 >> > + (- 10 x) >> > + (/ x 2)) >> > + =E2=87=92 3" >> > + (declare (indent 1)) >>=20 >> I'm not enthusiastic. As experience with the other threading macros has >> shown, they're neat hacks, but they're not used much in actual code >> (because there's no culture for reading code that's formatted that way >> in Emacs Lisp). I agree that the threading style hasn't become popular in Emacs core. But some users and package authors rely on it a lot. Moreover, if 2 of the 3 basic threading macros are already provided, it seems a bit incongruent not to offer the third. Matters of taste aside -- I only use threading occasionally -- I think it can objectively turn certain really ugly constructs into something that is at least palatable. >> If others think that this would be useful, I won't object to adding it, >> though. Eli, what do you think? > > TBH, I tend to agree. And I'd like to hear the rationale, to make the > discussion more concrete. Maybe if the reasons are good enough, I'll > change my mind. Just looking at the usage, it does sound a bit > artificial. One concrete example where thread-as would help is in the situation outlined in the following message, specifically the point that =E2=80=9Ctot= ally breaks down if you want to mix in LITERAL etc=E2=80=9D: https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg01653.html But since I proposed the macro, maybe I should wait and see if someone else finds it useful, and in which situation. (Also, for whatever little it's worth, the macro generates smaller bytecode than the =E2=80=9Cjust give up and go all imperative=E2=80=9D alte= rnative mentioned in the linked message.)