Re: ArchiveEntry optional arguments refactoring - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: ArchiveEntry optional arguments refactoring
Date
Msg-id 905ae2b2-3fe2-cba7-7005-12bf9287cf6b@anastigmatix.net
Whole thread Raw
In response to Re: ArchiveEntry optional arguments refactoring  (Andres Freund <andres@anarazel.de>)
Responses Re: ArchiveEntry optional arguments refactoring  (Dmitry Dolgov <9erthalion6@gmail.com>)
List pgsql-hackers
On 1/23/19 12:25 PM, Andres Freund wrote:
> On 2019-01-23 12:22:23 -0500, Chapman Flack wrote:

>> ArchiveEntry(fout, dbCatId, dbDumpId, .tag = datname, .owner = dba,
>>              .desc = "DATABASE", .section = SECTION_PRE_DATA,
>>              .defn = creaQry->data, .dropStmt = delQry->data);

> IDK, it'd be harder to parse correctly as a C programmer though. ...
> weirdly mixing struct arguments and normal function arguments seems
> quite confusing.

Hmm, I guess the rubric I think with goes something like "is a C
programmer who encounters this in a source file for the first time
likely to guess wrong about what it means?", and in the case above,
I can scarcely imagine it.

ISTM that these days, many people are familiar with several languages
that allow a few mandatory, positional parameters followed by optional
named ones, and so a likely reaction would be "hey look, somebody used
a macro here to make C look more like <insert other language I know>."

On 1/23/19 12:32 PM, Tom Lane wrote:
> Can we omit the initial dots if we use a wrapper macro?

That, I think, is hard.

Getting to the form above is downright easy; making the dots go away,
even if achievable, seems way further down the path of diminishing
returns.

Regards,
-Chap


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [HACKERS] REINDEX CONCURRENTLY 2.0
Next
From: Peter Geoghegan
Date:
Subject: Re: Non-deterministic IndexTuple toast compression fromindex_form_tuple() + amcheck false positives