Re: mogrify and indent features for jsonb

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: mogrify and indent features for jsonb
Дата
Msg-id 55412C7F.10507@dunslane.net
обсуждение исходный текст
Ответ на Re: mogrify and indent features for jsonb  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: mogrify and indent features for jsonb  (Kevin Grittner <kgrittn@ymail.com>)
Re: mogrify and indent features for jsonb  (Jan de Visser <jan@de-visser.net>)
Список pgsql-hackers
On 04/29/2015 01:19 PM, Robert Haas wrote:
> On Mon, Apr 27, 2015 at 6:41 PM, Andrew Dunstan <andrew@dunslane.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.

cheers

andrew



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: INSERT ... ON CONFLICT syntax issues
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: INSERT ... ON CONFLICT syntax issues