5 ms·
I mostly agree with this, nobody likes `fobricate(true, false, true)`. I do have to wonder if this is a cure for the lack of named function arguments in C++.
by planede 3y ago
I mostly agree with this, nobody likes `fobricate(true, false, true)`. I do have to wonder if this is a cure for the lack of named function arguments in C++.
- bluGill 3y agoEven in languages with named function arguments you still end up with the same problem very often. The person who wrote fobricate(True, False, True) in python knows what order things are and probably didn't bother to name each one. You could force naming all arguments, but that gets ridiculous as well in a different way.
- Koshkin 3y agoOne approach would be to have custom types (i.e. classes) so that you could write things in a type-safe manner: fobricate(type1(), type2(false), type3()); Here 'true' is the default. The only difference between these types would only be in the name, so they all can have a common base.