Re: Allow declaration after statement and reformat code to use it

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Allow declaration after statement and reformat code to use it
Дата
Msg-id 1760990.1629390445@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Allow declaration after statement and reformat code to use it  (Chapman Flack <chap@anastigmatix.net>)
Список 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 по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: RFC: Logging plan of the running query
Следующее
От: Alvaro Herrera
Дата:
Сообщение: reporting TID/table with corruption error