The parent post outlines many techniques, including this. Some are more apt than others depending on your language of choice.
I would argue that there's another option of passing a strongly typed struct for args, and that the JavaScript and Ruby solution of dicts falls between this and kwargs.
I'm fond of properly designed fluent APIs, myself.
While on the subject of homogenous argument types, especially bad are the APIs that not only accept the same types, but have order semantics that differ between functions within the same library. PHP used to be a notoriously bad example of this with respect to their needle and haystack search parameters. (I think they fixed it?)
The "JS solution" for example is not a solution, but only a convention: the actual interface is just expecting an object, and there is no explicit check on the validity of such object or its contents. That is nowhere near "strongly typed", if anything it's weaker than average.
Well if it uses de-structuring syntax, then it can be type-checked.
interface CopyArgs {
src: string;
dst: string;
}
function copy(args: CopyArgs) {
exec(["cp", args.src, args.dst])
}No, they put out a conf talk that stated that there _was_ a logic to it, you just needed it to be explained to you.
But nobody talks about how nonsensical C function names are.