Re: mogrify and indent features for jsonb

From: Jan de Visser <jan(at)de-visser(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Subject: Re: mogrify and indent features for jsonb
Date: 2015-04-29 20:06:51
Message-ID: 2878156.XghlRr5Sfa@wolverine
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On April 29, 2015 03:09:51 PM Andrew Dunstan wrote:
> On 04/29/2015 01:19 PM, Robert Haas wrote:
> > On Mon, Apr 27, 2015 at 6:41 PM, Andrew Dunstan <andrew(at)dunslane(dot)net>
wrote:
> >> There's one exception I, at least, have to this rule, namely when there's
> >> a
> >> corresponding compound if or else. I personally find this unaesthetic to
> >> put>>
> >> it mildly:
> >> if (condition)
> >>
> >> statement;
> >>
> >> else
> >> {
> >>
> >> block of statements;
> >>
> >> }
> >
> > Hmm, I don't dislike that style. If somebody submitted a patch with
> > braces around the lone statement, I would remove them before
> > committing.
> >
> > <ducks>
>
> It's a matter of taste, but I find things a lot easier to understand
> when they are symmetrical. Thus I like all the branches of an "if" to be
> either in a block or not, and I like braces to line up either
> horizontally or vertically. Perhaps this reflects my history, where I
> wrote huge amounts of Ada and other non-C-like languages, well before I
> ever wrote lots of C or C-ish languages.
>
>
> Another case where I think putting a single statement in a block makes
> sense is where the condition of the "if" spreads across more than one
> line. This works particularly well with our BSD style brace placement.

I'm sure that many, many bits have been spilled over this, reaching way back
into the stone age of computing, sometimes almost reaching emacs-vs-vi levels
of intensity.

My position is the better-safe-than-sorry corner, which says to always add
braces, even if there's only one statement. Because one day somebody will be
in a rush, and will add a second statement without adding the braces, and
things will explode horribly.

But that's just me.

jan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-04-29 20:12:05 Re: Custom/Foreign-Join-APIs (Re: [v9.5] Custom Plan API)
Previous Message Kevin Grittner 2015-04-29 20:04:12 Re: mogrify and indent features for jsonb