Re: Allow declaration after statement and reformat code to use it - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Allow declaration after statement and reformat code to use it
Date
Msg-id 1760990.1629390445@sss.pgh.pa.us
Whole thread Raw
In response to Re: Allow declaration after statement and reformat code to use it  (Chapman Flack <chap@anastigmatix.net>)
List pgsql-hackers
Chapman Flack <chap@anastigmatix.net> writes:
> I'm in sympathy with all of those points. I've never believed that the
> arbitrary separation of declaration from use that was forced by C < 99
> made anything more readable. If the project were started now from scratch,
> I would be all in favor of declaring at first use.

Yeah, if we were starting today, I'm sure we'd use C99 or C++ as our
baseline and not arbitrarily exclude some language features.  But ...
we're not.  The rule against declaration-after-statement was kept
after significant discussion, which you can find in the archives if you
look.  We're not going to drop it just because one person shows up with
a patch to do so.

>>> It uses a Perl regex to search and replace! (obligatory jokes at the
>>> bottom of the email)

> However, even if such an idea were to get the green light, I think I would
> take the obligatory regex jokes seriously, and instead use something like
> srcML [0] and do the analysis and modification on proper parse trees.

Agreed.  I think the odds of introducing bugs are near 100% if it's done
without using a tool that actually understands the code semantics.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: RFC: Logging plan of the running query
Next
From: Alvaro Herrera
Date:
Subject: reporting TID/table with corruption error