3 ms·
But the recommendation sounds like it's trying to work around a limitation of the language. "We don't support named parameters, therefore, create an enum whene
by hota_mazi 5y ago
But the recommendation sounds like it's trying to work around a limitation of the language.
"We don't support named parameters, therefore, create an enum whenever a boolean would have been enough with proper support of named parameters".
I think this is unsound reasoning, but regardless of whether you agree with this or not, the idea of creating an enum for every boolean that gets passed to a function sounds pretty crazy to me.
If you have named parameters, you just don't need to create an enum whenever you are passing a boolean to a function.
- solmag 5y agoI think it's good the way the Rust API guidelines lay it out. It will also introduce additional lightweight documentation (in form of a type) and reduces amount of raw booleans in the code, and will get the benefits of the advanced type system too, and somewhat future proofs it that way too.