Re: A small rant about coding style for backend functions

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Brendan Jurd <direvus(at)gmail(dot)com>, Gregory Stark <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: A small rant about coding style for backend functions
Date: 2007-11-08 16:17:32
Message-ID: 200711081617.lA8GHWG17979@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera wrote:
> > > Having said that, there are two or three tips worth knowing about
> > > pg_indent's behavior, like when and how to use dashes to prevent
> > > comment blocks from being re-flowed. But it's a short list.
>
> If someone submits a piece of code that's totally out of line with our
> standards, we will ask him to resubmit. This step could be avoided if
> he knew what those standards were in the first place.

True, but 95% of the cases are submitters using the wrong functions,
methods, etc, not the style. I don't remember us ever returning a patch
for rework based on style issues alone.

> PG_GETARG and the like are not fixed by pgindent though (which is what
> spawned this whole discussion). And in-house code (or pgFondry code),
> which could also benefit by our coding style, will not be processed by
> pgindent anyway.
>
> > <P><I>pgindent</I> will the format code by specifying flags to your
> > operating system's utility <I>indent.</I> This <A href=
> > "http://ezine.daemonnews.org/200112/single_coding_style.html">article</A>
> > describes the value of a consistent coding style.</P>
>
> I don't understand why would you link to an article about the value of
> consistent coding style, and not provide a link to our own coding style.
>
> I also don't understand why pgindent is assumed to be some sort of
> silver bullet to solve all our coding style problems. It is better if
> we educate our developers instead of just having pgindent at the end of
> the cycle deal with the messed up code. Up to now, this education has
> been one individual at a time, but it is much better if we can scale in
> a way that every individual wastes only his own time learning our rules.

We want patch submitters to spend their time on patches, not learning
our style. The fact is that pgindent is a silver bullet in some ways.

My major contention is that any list is going to be very details and
hard to read, and no one has put up a list disputing that.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-11-08 16:29:43 Re: Postgresql 8.3 beta crash
Previous Message Tom Lane 2007-11-08 16:13:26 Re: A small rant about coding style for backend functions