From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id qFtYMAmbdmP0TAEAbAwnHQ (envelope-from ) for ; Thu, 17 Nov 2022 21:35:21 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id mF88MAmbdmP1rgAAauVa8A (envelope-from ) for ; Thu, 17 Nov 2022 21:35:21 +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 9F0E03AF3B for ; Thu, 17 Nov 2022 21:35:21 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovlbF-0000AA-5O; Thu, 17 Nov 2022 15:35:05 -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 1ovlbD-00009Q-B2 for guix-patches@gnu.org; Thu, 17 Nov 2022 15:35:03 -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 1ovlbD-0008Oz-1q for guix-patches@gnu.org; Thu, 17 Nov 2022 15:35:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ovlbC-0003eN-Rm for guix-patches@gnu.org; Thu, 17 Nov 2022 15:35:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59164] Coding style: similarly-named variables Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 17 Nov 2022 20:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59164 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 59164@debbugs.gnu.org, 58812@debbugs.gnu.org Received: via spool by 59164-submit@debbugs.gnu.org id=B59164.166871727813982 (code B ref 59164); Thu, 17 Nov 2022 20:35:02 +0000 Received: (at 59164) by debbugs.gnu.org; 17 Nov 2022 20:34:38 +0000 Received: from localhost ([127.0.0.1]:34531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovlao-0003dN-4r for submit@debbugs.gnu.org; Thu, 17 Nov 2022 15:34:38 -0500 Received: from mail-qt1-f176.google.com ([209.85.160.176]:37821) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovlal-0003d4-2x; Thu, 17 Nov 2022 15:34:36 -0500 Received: by mail-qt1-f176.google.com with SMTP id l15so1911374qtv.4; Thu, 17 Nov 2022 12:34:35 -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=D8g2H1couwc9wvxak+9BIHQcWcgXJ03zy6cZpvnbnFI=; b=csBQ9koAauuQif8uEUmm7lqs1VtxXVOKl8BCEkh/9Fi8Gdc+lMmktLEo8Tg1U5ZEPh edB0NBt6Pbu/xiZcJA3ZPOf2ldsUB+azRwCO/3ssOu4lxcthXGSJ0NzxRmvM9XPDU4SG N0vkQXX4UFKHTIMT3lNI3SzlofXo3TsG1IL5UuSzCNfI7azBoSLGnT5vWvQVY1ADt1bx otFgsfKWfbJednMG6zpIedEbr7uqvIA7Vr6Oy2DTvzri9kcAuNITggfE5KN2GRpQYBp5 WP96hK9a2oiXVoZc9eWNpyrmRPCWg1yznOpBmDz6wIh3o3prM9hsAjnPN3bBypS43l5L lK+g== 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=D8g2H1couwc9wvxak+9BIHQcWcgXJ03zy6cZpvnbnFI=; b=GWnfykC7H7etgPFnrYDJEYwbkonZZ4EGxeaEYQL3sk5KGT8Lf24/9KFp9Lq8Saj7aN YnAtqRYLSDf7PN563DpkhBYAv1TYH25qToYs/N/w/qpKFELc5Cmf21dHwEbyL2MvtCde 6WUqKdTzHpmiAMLuRWQQRGxahaH+5kre2vfTT/SkhvYsA5VSQshOhWGiZdBcAmXJDaOZ ccT4RPhmRgJUj3DxIIxKsNaYdan3/KD64f3arjdJ7+EUwQQlsdmLEkiUlTHAV4Mjt6TK eWlMu5V0ZZC1086wuJxisU6DXjB411dzjY5gXRmBUGbPmUTMJmBK7f9alKFPRBJpuJGy xMaQ== X-Gm-Message-State: ANoB5plz6IquerI+7fGH1EOvLyekKVyysGhnGyE53+FDhLDiJ4KPXOZ4 rBefJt1P6znvYWIRtt+KGdf4HPVcnNE= X-Google-Smtp-Source: AA0mqf5TVcJ6pZMXnlsLXfADPpfk5dZlSC/1XOxRhLMPnY7zVzSTWeWPx9r2MF1ghDPDr+DWWT34Tg== X-Received: by 2002:ac8:1483:0:b0:39c:bf89:65f0 with SMTP id l3-20020ac81483000000b0039cbf8965f0mr3941924qtj.35.1668717269380; Thu, 17 Nov 2022 12:34:29 -0800 (PST) Received: from hurd (dsl-10-133-21.b2b2c.ca. [72.10.133.21]) by smtp.gmail.com with ESMTPSA id p5-20020ac84605000000b003a55fe9f352sm863559qtn.64.2022.11.17.12.34.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 12:34:29 -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> Date: Thu, 17 Nov 2022 15:34:27 -0500 In-Reply-To: <87sfihfpng.fsf_-_@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 17 Nov 2022 18:37:39 +0100") Message-ID: <87v8ndtj58.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=1668717321; 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=D8g2H1couwc9wvxak+9BIHQcWcgXJ03zy6cZpvnbnFI=; b=Rxt0SWTv8oPWqcAvVFEq25FBfxhvXSSODbBigyTINmrLSR2J6FYopLN8wyUcCaSVhZVMh4 6qf1HcgwBUAj29PbGsDH9nGxxNkRPI3HSsYsTWPZn8plniWto6jvdGF8jQFHjVkwbam4Ej Gl7H7IbxjutgFthMtcRwLrDA5NBgT3tdGuBnfsr4lfsteycJcxMT0GMFLv8MXOmw6lvQeH ytJ2pl51YFQ4+/ZAVG9JsU/dWeEPbw31Uz9kDVz8P20A50HkX46X4UAVocQaPkQL0pbEic Qyrc2BKTiozCU41pMX4ZzpMtCzd8qhTJB3r9v2iaaLL7gWJUGne1lZece4fgvw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668717321; a=rsa-sha256; cv=none; b=hmBLaHIxW2nhM7e4WeL1vf77zJPJ8W2yXhC3SuXe4KE7L+/ep/trb95wE42YevBHX07Kax 7o6Py9atcWbxUrd9fwYrXgfkZUl1aGyXfOwjifOO1cS7oMTGkCY3IpPmtEK3Bed37WIhlS NZotEnCmpUDf9UKBLaZ1FTpbs9ZI8Pj8gFUMihUN2TX7R35FOFl+K3I04M/d1kQtXjS8IZ 5Min9Hmck91EFIEODtiGdAugmH8HZBcCgKXc3kJHFhJD0F+9Zy5UvkDdFGbuYLLgSq04XJ CIsjXz7ghrqq6y646bF6MoXzZ30g0XQl3g7SHtNMCA2jKAgTJJ7N6MgE3njsrQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=csBQ9koA; 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: 5.97 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=csBQ9koA; 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: 9F0E03AF3B X-Spam-Score: 5.97 X-Migadu-Scanner: scn1.migadu.com X-TUID: Y3F7K3N85EsN Hi, Ludovic Court=C3=A8s writes: > Hi, > > Maxim Cournoyer skribis: > >> Ludovic Court=C3=A8s writes: >> >>> Maxim Cournoyer skribis: >>> >>>> * gnu/build/install.scm (evaluate-populate-directive): By default, err= or when >>>> the target of a symlink doesn't exist. Always ensure TARGET ends with= "/". >>>> (populate-root-file-system): Call evaluate-populate-directive with >>>> #:error-on-dangling-symlink #t and add comment. >>> >>> [...] >>> >>>> + (define target* (if (string-suffix? "/" target) >>>> + target >>>> + (string-append target "/"))) >>> >>> Maybe make it: >>> >>> (let ((target (if =E2=80=A6))) >>> =E2=80=A6) >>> >>> so there=E2=80=99s only one =E2=80=98target=E2=80=99 in scope (and no = =E2=80=98target*=E2=80=99); otherwise it=E2=80=99s >>> easy to forget the =E2=80=98*=E2=80=99 and refer to wrong one. >> >> 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 usin= g 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. I'm surprised you're not buying it, given we're writing Scheme in a more functional style, and mutating same-named variables clearly goes against that style :-). > 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? That's more of a coding style guidelines than "formatting" code (when I read "formatting", I think of a mechanical process like 'guix style' or 'rust-fmt' can do), but yes, that could be nice to have. Better yet, something basic to share across the whole Guile/Scheme community and include in the Guile user manual, like Python has PEP 8 they can refer to, to save every Guile/Scheme project from having to reinvent the wheel. --=20 Thanks, Maxim