Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNJvR-0002yi-8R for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Apr 2020 17:28:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jNJvO-0002Xh-28 for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Apr 2020 17:28:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNJvN-0002Xa-Qu for pgsql-hackers@lists.postgresql.org; Sat, 11 Apr 2020 17:28:09 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jNJvG-0000to-CN for pgsql-hackers@postgresql.org; Sat, 11 Apr 2020 17:28:09 +0000 Received: by mail-pg1-x533.google.com with SMTP id r4so2438599pgg.4 for ; Sat, 11 Apr 2020 10:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=L/CTSm09qSmqfWXy4Fx1Sa4zEL4H+KDK5qP87x371pI=; b=mo+tgT4o5d2R/OkAyJ9hFx8STECU2i3L1ow6g1qI1NyeDZs2AhX9WIdnqdBKE8nNEH p1SvEsZVzi4HP0kqOXqO/EW//JiOGBzCduwN03Y+gEtqExNCfDML7lZqWVEeg5mCvWK3 CeUDCeKPOtJ+gCbJLBrVUskd1Jp8mbw1N+uLIhudVCGS8/5kESQPinEctIF8Vrm4rHJH eNpnsnAhylnPoMmS76BhYwpu/aYPNjQhMuC2K5QkZhqomChqulG3gQfknUglcsqEguG+ CQTeNsAqK3/yJej8PrpLD8MLUa3/42bfzCTxZT6IlPpz9wDqTMYKFGHuuEC9bq8MXkkm fQeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=L/CTSm09qSmqfWXy4Fx1Sa4zEL4H+KDK5qP87x371pI=; b=N9dFTtPwudwqu7M1Cxo8BNV5T/ahsISqmGc4amcXvOn0TZ0aYtK56U5edjGecJUxkn IOC7Bu1TCfuFyI+nCMeln3UZpPSkiXHkisKQcbE/INxsRkCUYR3rI40uFJnknJObSWYq JloQBbSpF5VzINXghlo0x2onhy+aksqqz9s3oSyBuCKqZrDOeD6stc4Em6LmPBM3qlT8 tpkO0fHlKzMheO+RbiRhgE/4ZnsbLNm88h6IKWMRJW2HZdC0LQJPJjqL4NfQf+JtjJ9f JucLLso59SZRbeRdqcjQ6LRo1pej3/Vp9Rc1nMY8FuyX439grwcK9YOCNjKb8JaHKcFv zpyw== X-Gm-Message-State: AGi0Pub5jA4F0D3J2+AQxUdVQhfefbH834fDcGSeqScyYFLlzVqt0Ik5 hG61QB6+WUqET39wqZ5FJLa3A5V1zZU1SbK2PIkRtUXX0ObVuzzohDY8MwU0mIlhxhq+LoR/iBf WsKy6QwZB6YQncQRrbcAhMdYfSIgDkVr1PsVmvkzyIMezG/KCs0Gex1fJrsQkG169A14MAIecny HR+f9Tl2ibN5NpFv+cCP4q8Gn0deC51w== X-Google-Smtp-Source: APiQypLOhPFPS6detuIZgk6ncOKAyUbGthS60uMTtW7+g21wCVr6RUx0oyn+8Htua/Z8G4fv3zZCCQ== X-Received: by 2002:a63:140c:: with SMTP id u12mr3469206pgl.243.1586626079888; Sat, 11 Apr 2020 10:27:59 -0700 (PDT) Received: from [192.168.0.29] (24-113-193-150.wavecable.com. [24.113.193.150]) by smtp.gmail.com with ESMTPSA id q67sm4757866pjq.29.2020.04.11.10.27.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Apr 2020 10:27:59 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: cleaning perl code From: Mark Dilger In-Reply-To: <5b2ae2b0-8b09-d153-275a-24e7b2ac7989@2ndQuadrant.com> Date: Sat, 11 Apr 2020 10:27:58 -0700 Cc: Noah Misch , PostgreSQL-development Content-Transfer-Encoding: quoted-printable Message-Id: <4FFD55FA-0728-4DC3-AF93-0246FE555C10@enterprisedb.com> References: <20200411043014.GA590991@rfd.leadboat.com> <0a4406d5-b428-4831-8ed9-c36764360f57@2ndQuadrant.com> <97813D8D-F185-4998-8CF8-5678746E7DEE@enterprisedb.com> <5b2ae2b0-8b09-d153-275a-24e7b2ac7989@2ndQuadrant.com> To: Andrew Dunstan X-Mailer: Apple Mail (2.3608.80.23.2.2) X-CLOUD-SEC-AV-Info: edb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Apr 11, 2020, at 9:47 AM, Andrew Dunstan = wrote: >=20 >=20 > On 4/11/20 12:28 PM, Mark Dilger wrote: >>=20 >>> On Apr 11, 2020, at 9:13 AM, Andrew Dunstan = wrote: >> Hi Andrew. I appreciate your interest and efforts here. I hope you = don't mind a few questions/observations about this effort: >=20 >=20 > Not at all. >=20 >=20 >>=20 >>> The >>> last one fixes the mixture of high and low precedence boolean = operators, >> I did not spot examples of this in your diffs, but I assume you mean = to prohibit conditionals like: >>=20 >> if ($a || $b and $c || $d) >>=20 >> As I understand it, perl introduced low precedence operators = precisely to allow this. Why disallow it? >=20 >=20 > The docs say: >=20 >=20 > Conway advises against combining the low-precedence booleans ( |and > or not| ) with the high-precedence boolean operators ( |&& || !| ) > in the same expression. Unless you fully understand the differences > between the high and low-precedence operators, it is easy to > misinterpret expressions that use both. And even if you do > understand them, it is not always clear if the author actually > intended it. >=20 > |next| |if| |not ||$foo| ||| ||$bar||; ||#not ok| > |next| |if| |!||$foo| ||| ||$bar||; ||#ok| > |next| |if| |!( ||$foo| ||| ||$bar| |); ||#ok| I don't think any of those three are ok, from a code review perspective, = but it's not because high and low precedence operators were intermixed. >>=20 >>> and the use of commas to separate statements >> I don't understand the prejudice against commas used this way. What = is wrong with: >>=20 >> $i++, $j++ if defined $k; >>=20 >> rather than: >>=20 >> if (defined $k) >> { >> $i++; >> $j++; >> } >>=20 >=20 >=20 > I don't think the example is terribly clear. I have to look at it and > think "Does it do $i++ if $k isn't defined?" It works like the equivalent C-code: if (k) i++, j++; which to my eyes is also fine. I'm less concerned with which perlcritic features you enable than I am = with accidentally submitting perl which looks fine to me but breaks the = build. I mostly use perl from within TAP tests, which I run locally = before submission to the project. Can your changes be integrated into = the TAP_TESTS makefile target so that I get local errors about this = stuff and can fix it before submitting a regression test to -hackers? =E2=80=94 Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company