From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mG48OvW6d2NXVAAAbAwnHQ (envelope-from ) for ; Fri, 18 Nov 2022 18:03:50 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id eKolOvW6d2OmxAAA9RJhRA (envelope-from ) for ; Fri, 18 Nov 2022 18:03:49 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B686519A63 for ; Fri, 18 Nov 2022 18:03:49 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ow4ll-0001dN-1d; Fri, 18 Nov 2022 12:03:13 -0500 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 1ow4la-0001Ur-Bc for guix-patches@gnu.org; Fri, 18 Nov 2022 12:03:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ow4la-000506-2h for guix-patches@gnu.org; Fri, 18 Nov 2022 12:03:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ow4lZ-0001X6-TF for guix-patches@gnu.org; Fri, 18 Nov 2022 12:03:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#58812] [bug#59164] Coding style: similarly-named variables Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 18 Nov 2022 17:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58812 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 59164@debbugs.gnu.org, 58812@debbugs.gnu.org Received: via spool by 58812-submit@debbugs.gnu.org id=B58812.16687909735872 (code B ref 58812); Fri, 18 Nov 2022 17:03:01 +0000 Received: (at 58812) by debbugs.gnu.org; 18 Nov 2022 17:02:53 +0000 Received: from localhost ([127.0.0.1]:38121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ow4lR-0001Wd-96 for submit@debbugs.gnu.org; Fri, 18 Nov 2022 12:02:53 -0500 Received: from mail-qk1-f169.google.com ([209.85.222.169]:38814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ow4lP-0001WM-F7; Fri, 18 Nov 2022 12:02:51 -0500 Received: by mail-qk1-f169.google.com with SMTP id s20so3845772qkg.5; Fri, 18 Nov 2022 09:02:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=GZqS0vELfbgnJQqgEuoyKqeSudkJk9ipeJxdZdtd/cs=; b=Sd6xtZ69GR828LndhYUUIomNc+mPCs8XGNLME9KtnKtj1VEgyef+Vd1/HAoPxlepsx zOnNe3yWtPqTVoh2cRRw6n09fbsszPLgXEI97dy+OYyYq4vlxQgmSrB9//diFCiYSn57 o2Ynu61Uzotaat+4QLFJ71ODGwWW4pRIuUT4AJxLvpP85iieqDVOiY0DcoOORlxY4tHy sZsyUbUcCq1nrinXb5w/u3EYDWLJiqEeV5Lg5Z/QuUh6HcK5Q7ljJ0TZqMw8bfznQGS8 pqP5ePTM0Grj9ZgQGSddZFS4ZtmpifL+anDjYndDgdszHGvDBiq0H+G7yVzafzqP/ysd QSMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=GZqS0vELfbgnJQqgEuoyKqeSudkJk9ipeJxdZdtd/cs=; b=wGBlRccEo6zndQuqNiHzHxkQIKbhkJTJo2cO+bpTDTv360QGr0dwBtfKLKbAknMPTK f54EC0f4dUJjNYaZDmLt5zOYOfLGax96wvrq6fT2jwrv+mEjIsEJ4f+vHaCIOcJrhGcr f8rDY589aiiPPOvCmqRKJdQ5QdxZvHxv86IP/e+Czl5GT2cehRTXOKQcvjzv9x51pujR 15T1cSnwz6rMtO8zHqPMgj90n9k59B3o221hXENqrS5+mMOUs6pjkeE4j4d1u/AV28sS AO1RSw5Xdeue3zHZ5ZpXMI9gwlgNFlAb4oLDyFwzEUERMrheQ0Un/OS5dAu2uPJyHpgD zonQ== X-Gm-Message-State: ANoB5pngL4nHToaBbeijjGl8uMm+PiZ5EOvwbVKhOOIET054+0L2QFyP HGuDOUTgpW3usFwSPaG4dQe74Vq6gzPZcw== X-Google-Smtp-Source: AA0mqf7EqziDVhlEjMOjAqB5FXv29sGCXgip9eTetG1nOIM/mWoLvICQ24QGu5nI7HM2jD+AW3qQsw== X-Received: by 2002:a37:b96:0:b0:6fa:1031:5b2f with SMTP id 144-20020a370b96000000b006fa10315b2fmr6682368qkl.585.1668790965632; Fri, 18 Nov 2022 09:02:45 -0800 (PST) Received: from hurd (dsl-10-132-210.b2b2c.ca. [72.10.132.210]) by smtp.gmail.com with ESMTPSA id w11-20020a05620a444b00b006fb72dbbaa4sm2736649qkp.27.2022.11.18.09.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 09:02:45 -0800 (PST) From: Maxim Cournoyer References: <20221027035100.28852-1-maxim.cournoyer@gmail.com> <20221027035100.28852-3-maxim.cournoyer@gmail.com> <87leojon1z.fsf_-_@gnu.org> <877d03xywl.fsf@gmail.com> <87sfihfpng.fsf_-_@gnu.org> <86zgcpju9p.fsf@gmail.com> Date: Fri, 18 Nov 2022 12:02:44 -0500 In-Reply-To: <86zgcpju9p.fsf@gmail.com> (zimoun's message of "Thu, 17 Nov 2022 19:44:18 +0100") Message-ID: <87y1s82o23.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1668791029; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=GZqS0vELfbgnJQqgEuoyKqeSudkJk9ipeJxdZdtd/cs=; b=crC7KJx6UW7SCyNxDx2Dt+JAStutvfec65SEL9jTHAvkV2Ekc3tHx5J+2IsS5R0Ue/NQIc 6Gc9Fce3ELRsvPGzCWPPg/pjQk3qPEZ//PauVQvycbc2PN7w+uXRekgvFUUxERZm3SJPP4 GlspRt4aDMMRgBw0cyyzJs2qdRCyzODulEutZmsnX6ipS1Ee3J4lHXyQyXcO3krtLvH3cQ yz2ZUB1LMaIrNq1ZPUm7OpDQwbEo7E2Fp06d3FkH0JojTlpLjcph7kQ94eMNnR6uWy1Q4i MIfFoYW1I8G5DmGogQzm6tW2X1/tZuYrI6umeJiZVd3bIy3jevXkzo8IG/47eQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668791029; a=rsa-sha256; cv=none; b=u2+u7BgJg6k7OAPjpPJ6rvxABy87BA6uClVoZhc9XLn5iAH36LXf4f/Wig+WqQ817kkudV 5HdQ+X/s2H4cLDwBOX7EYVrVyLHL3NRWiFmYKqKHHTGG1hHWNkkOAw/rSwpVeCsLoIjsfw 7kX3xNRZvTIDJzXG7i+lRMK523ViJechdWaO5Zr3ibAmxLjdt9iEgEIIYIx335atG/HqLW O93wi0EtzMsuva7ZUjKDm+f8XM8f5Holh5uEcR7PIToNWBLShue6975pSEKRs78ZXM/+rd /JDhdu3jFTi8rj5gj4ue0VRgsOBHlodjtoutCTkfuMVK4H851gwz8Jt2LdhOtw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Sd6xtZ69; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 8.78 X-Spam: Yes Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Sd6xtZ69; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B686519A63 X-Spam-Score: 8.78 X-Migadu-Spam: Yes X-Migadu-Scanner: scn0.migadu.com X-TUID: SGkG7WG6gDov Hi, zimoun writes: > Hi, > > On Thu, 17 Nov 2022 at 18:37, Ludovic Court=C3=A8s wrote: > >>> It's a pattern I've used at other places; I find it more hygienic to not >>> shadow existing variables; it signal to the reader "be careful, this is >>> not the same as the argument-bound one, though they are closely >>> related". >> >> I don=E2=80=99t buy it. :-) The reader might be careful yet end up usi= ng the >> =E2=80=9Cwrong=E2=80=9D variable. As long as the =E2=80=9Cwrong=E2=80= =9D variable has no use, I think >> it=E2=80=99s best to shadow it so that mistakes cannot happen. >> >> Of course the details vary depending on context, but I think we should >> not start introducing this pattern in different places. Perhaps >> something to discuss and codify under =E2=80=9CFormatting Code=E2=80=9D? > > I agree with Ludo. For another instance than target*, the previous was, > > ((new '-> old) > [...] > - (symlink old (string-append target new))) > [...] > - (delete-file (string-append target new)) > > > then replaced by, > > ((new '-> old) > [...] > + (let ((new* (string-append target* new))) > [...] > + (error (format #f "symlink `~a' points to nonex= istent \ > +file `~a'" new* old))))) > + (symlink old new*)) The intent was to keep away from the following imperative style, which hurts both readability and debuggability in my opinion: --8<---------------cut here---------------start------------->8--- (let* ((my-target "something") (my-target (mutate-once my-target)) (my-target (mutate-twice my-target))) (do-something-with my-target)) --8<---------------cut here---------------end--------------->8--- Perhaps the problem at hand would benefit being broken down in smaller chunks, to avoid having a page-full of code sharing the same scope. --=20 Thanks, Maxim