63
I keep tripping over “true, false, true”
(allthingssmitty.com)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
Not saying that named parameters are bad, but the builder pattern serves the same purpose and imo it's more ergonomic.
I don't care about the color of the train or the amount of wheels, I just want the default train with a few changed parameters.
If you do named parameters in rust, you would need to set every parameter. The only way to not set every parameter is to give a special meaning to the
Defaulttrait. But that is uncommon to happen in rust. And many structs that could easily deriveDefaultdon't.If that's the condition, yeah, it's bad. The good thing about how Python handles it is that they can still be mandatory or optional. And that makes it a more flexible option than the builder pattern because it applies to any function or method.