Re: cleaning perl code

Mark Dilger <mark.dilger@enterprisedb.com>

From: Mark Dilger <mark.dilger@enterprisedb.com>
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: Noah Misch <noah@leadboat.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2020-04-11T16:28:03Z
Lists: pgsql-hackers

> On Apr 11, 2020, at 9:13 AM, Andrew Dunstan <andrew.dunstan@2ndquadrant.com> wrote:

Hi Andrew.  I appreciate your interest and efforts here.  I hope you don't mind a few questions/observations about this effort:

> 
>  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?

> 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++;
    }

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company






Commits

  1. Stop requiring an explicit return from perl subroutines

  2. Use perl's $/ more idiomatically

  3. Use perl warnings pragma consistently