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 1jNJIb-0001Y2-If for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Apr 2020 16:48:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jNJIZ-00066v-3O for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Apr 2020 16:48:03 +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 1jNJIY-00066o-SZ for pgsql-hackers@lists.postgresql.org; Sat, 11 Apr 2020 16:48:02 +0000 Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jNJIV-0000cI-Jp for pgsql-hackers@postgresql.org; Sat, 11 Apr 2020 16:48:02 +0000 Received: by mail-qv1-xf34.google.com with SMTP id k9so2382306qvw.7 for ; Sat, 11 Apr 2020 09:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:references:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=jYw0plAF5bSlvNsVkD19t3KP3zAQZ8W4E3JKoGMOBtI=; b=xknSwYhu/zefipjzAVgjbpGkKjqGfJ1/rljxsV36AdkrYiGFwELVCeo2UwmcDb96eE lsIH3KlPHpE8QO4FQuxowjVy04Rfoz2cwXJwSKxD1nYXwujEfntYhOuNA3vtl2HmEzhc iSMc2mm2QHBbC+fhwm1NHv+sufbxErLatYEEX2gn77zWaThK1nAxKa9ljntXzLLxXhd4 kNF1tBUgq2tBbe5mHLGE9LCMsdZbRlsab1Fk45Gv6NZbo2ctyFblX3eHcqHVQHreQvzk Asbd8FJN+pRsvpH3LJhIKM1VRYMdwZjc0rwb7CcQ8RqzFzWgnESv6fNrI7Y3AHAjEcYc sDyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=jYw0plAF5bSlvNsVkD19t3KP3zAQZ8W4E3JKoGMOBtI=; b=CaFtlGsyX2RkR502UeVfMzDXwTjUTuUnfZaov6HSv54+sxifaRghu0gAGapXGM3aVx +znAqIqC53w8OVNuKVjHbtr7QoYApxW9YuW/VYZXEpjrJl6cnNXSjaM+8DtCGsPQ1fjC vG0+gYzlxz1p8as6Yh3kOsyM9XikU/RmIrN0T2J4LjkBsJ7kD/zrsAS3B87TcMoNTAqL vjjVNhk8i1j2x5TiZ4VUbUTKJLbgRti95cLIQR27oPiawGta+oI4YTgcPUxhP3uNWc/2 nzzEphQj7Zy7scb4INvQP2tz1qXDUk7ncqBr3AVmTgk+nXFGUmCHfdfJV4UohJv0IVbh LTaA== X-Gm-Message-State: AGi0PuYvnQNEdEVkwiAJHlvbn/3vm9AIT86JB7hp2ouMM1u1yqfsj+D8 mmq7/Z5umaIqD+Se+JXihbD7pLxOjpobOENx3TnUTW8l9z+mZlTnmqeXX+yd5f5Xn4RDqJCCk+X elIghuTr/Ac53vp7stOFXBIAE4rUNShtYk037U3omqFwE9qDyf4sjEEJfB14RS+dQUL+fa41k9u 5SJXXT1obR0SHLiEo= X-Google-Smtp-Source: APiQypLh5mvjV33MovK8pA5ynvo8CWtPIqytrhARt932jrhhFdw0+GNsgD3dTdurb80JO0qwblZAog== X-Received: by 2002:a0c:ed24:: with SMTP id u4mr10203756qvq.67.1586623676470; Sat, 11 Apr 2020 09:47:56 -0700 (PDT) Received: from [192.168.10.146] (99-10-92-30.lightspeed.rlghnc.sbcglobal.net. [99.10.92.30]) by smtp.gmail.com with ESMTPSA id y132sm4163379qka.19.2020.04.11.09.47.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Apr 2020 09:47:55 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: cleaning perl code To: Mark Dilger Cc: Noah Misch , PostgreSQL-development References: <20200411043014.GA590991@rfd.leadboat.com> <0a4406d5-b428-4831-8ed9-c36764360f57@2ndQuadrant.com> <97813D8D-F185-4998-8CF8-5678746E7DEE@enterprisedb.com> Autocrypt: addr=andrew.dunstan@2ndQuadrant.com; prefer-encrypt=mutual; keydata= mQENBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAG0L0FuZHJldyBEdW5zdGFuIDxhbmRyZXcuZHVuc3RhbkAybmRRdWFkcmFudC5jb20+iQFY BBMBAgBCAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgBYhBOQ+WEYd/Hy/RGkVpZn6f8tZ /DuBAhkBBQJd1pSYBQkSzqMsAAoJEJn6f8tZ/DuBJmEIAIVFBIC3qGqh+YTPVTkfowwxpHz0 tZSPjZ6GS/5y62kgoZrZOVXw+Rg2ceuMM3a+In/RRjTx4bembgYqRKgzXlDfiNBJeq5ioVuN H1faDKE2lm5a6QkRQ2JU6DKf60fqSJGP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86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <97813D8D-F185-4998-8CF8-5678746E7DEE@enterprisedb.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/11/20 12:28 PM, Mark Dilger wrote: > >> 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: Not at all. > >> 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: > > if ($a || $b and $c || $d) > > As I understand it, perl introduced low precedence operators precisely to allow this. Why disallow it? The docs say: 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. |next| |if| |not ||$foo| ||| ||$bar||;  ||#not ok| |next| |if| |!||$foo| ||| ||$bar||;     ||#ok| |next| |if| |!( ||$foo| ||| ||$bar| |); ||#ok| I don't feel terribly strongly about it, but personally I just about never use the low precendence operators, and mostly prefer to resolve precedence issue with parentheses. > >> and the use of commas to separate statements > I don't understand the prejudice against commas used this way. What is wrong with: > > $i++, $j++ if defined $k; > > rather than: > > if (defined $k) > { > $i++; > $j++; > } > 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?" In the cases we actually have there isn't even any shorthand advantage like this. There are only a couple of cases. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services