> On Aug 1, 2021, at 12:48 PM, David Brownlee <a...@absd.org> wrote: > > On Sun, 1 Aug 2021 at 15:57, Jason Thorpe <thor...@me.com> wrote: >> >>> On Aug 1, 2021, at 5:15 AM, Martin Husemann <mar...@duskware.de> wrote: >>> >>> On Mon, May 10, 2021 at 10:30:09PM -0700, Jason Thorpe wrote: >>>> >>>>> On May 10, 2021, at 7:58 PM, matthew green <m...@eterna.com.au> wrote: >>>>> >>>>> please, can we revert and re-do with a type-safe API. >>>> >>>> I don't plan to revert, but I will consider a betterly-typed API >>>> that's not extremely cumbersome to use. I am not a fan of Taylor's >>>> proposals. Concrete proposals welcome. >>> >>> Ping? >>> >>> A decision on this API needs to happen before the netbsd-10 branch >>> (this is on the branch blocker list) - we need to either backout or move >>> forward some way. >> >> The situation hasn’t changed. I’m still waiting for concrete proposals. >> > > Possible thought to provide type safety with automatic versioning. > > Use C99 initializers with a CF_VERSION define. When cfargs changes we > bump CF_VERSION. > > config_found() needs to check passed cf_version and convert for old > versions. We are still left with a long tail of conversion code in > config_found(), but callers Just Work. > > config_found(CF_VERSION, self, whatever, (const struct cfargs *){ > .search = ..., > .locators = ..., > })
I would probably hide it in a macro (part of what I object to about this method, which was floated before, is that it is needlessly verbose). What do you propose should be the behavior if the versions don't match? I have an idea in mind, but I want to hear a concrete proposal first. -- thorpej