←back to thread

611 points LorenDB | 1 comments | | HN request time: 0s | source
Show context
GardenLetter27 ◴[] No.43908148[source]
It's a shame Rust doesn't have keyword arguments or named tuples to make handling some of these things easier without Args/Options structs boilerplate.
replies(5): >>43908333 #>>43908500 #>>43908653 #>>43912118 #>>43913516 #
jsat ◴[] No.43908653[source]
Had the same thought... It's backwards that any language isn't using named parameters at this point.
replies(1): >>43909426 #
Ygg2 ◴[] No.43909426[source]
Named parameters do come with a large footgun. Renaming your parameters is a breaking change.

Especially if you're coming from different langs.

replies(3): >>43912194 #>>43913869 #>>43938686 #
1. Spivak ◴[] No.43913869{3}[source]
I guess but you're changing your user-visible API so it should be a breaking change. In languages that don't have this type/arity is all that matters and the name is just nice sugar for the implementor who doesn't have to bind them to useful names.

Even if you don't use keyword args your parameter names are still part of your API surface in Python because callers can directly name positional args. Only recently have you been able enforce unnamed positional only args as well as the opposite.