Hi,
I have some functions whose behavior is defined by a bunch of booleans, which means that when I call them I don't know which is which:
let res = parse_1_param::<E, E2>(
input,
project,
&mut pins,
&mut pins_byname,
&mut substrate,
&mut params,
&mut model,
&mut mfactor,
true, /*count_only*/
&mut nb_params,
&mut nb_pins,
&mut nb_pins_byname,
&mut nb_substrate,
true,
true,
false,
false,
false,
true,
true,
false,
false,
false,
false,
&mut implicit_param_names,
)?;
- I could add a comment on each
true/falsebut this is error-prone (it won't survive a bad copy/paste). - I could define an enum for each argument:
enum ArgSub {
WithSub,
WithoutSub,
}
... but doing this for each one would add lots of noise to the function definition, plus I would need to add many use ...::ArgSub::* in files using it.
Is there a simpler idiomatic way to name my booleans at function definition time, without being too verbose ?