I'll still refrain from designing functions that way, and would encourage people to do the same.
Compared to keyword-varargs, an optional map argument costs at worst one more keystroke to invoke, and it's simply a more straightforward and regular behaviour to build on top of.
I suspect that most of the Clojure APIs out there which use keyword varargs did so by imitation of Python and just overlooked the alternative of using a map argument, or really had an unsound obsession with concision.
I agree, it's great for calling legacy functions, but that doesn't mean it has eliminated all the downside of keyword varargs. Avoiding irregularity is better than gaining tools for dealing with it.
EDIT: really, people are downoting this? Reminder of the Reddiquette: "Please don't downvote an otherwise acceptable post because you don't personally like it." Why not write a rebuttal instead?
I agree with what you’re saying but suspect that change was not made to Clojure core because of backwards compatibility. For that reason, I doubt it’ll ever be changed in Clojure core. This change likely suggests that there are some on the Core team who would have wished the keyword varargs feature to not have been included in the language originally.
Actually, just the opposite, the core team wishes this new feature had been included originally to make using kwarg style functions more widely used and embraced.
21
u/vvvvalvalval Mar 18 '21
I'll still refrain from designing functions that way, and would encourage people to do the same.
Compared to keyword-varargs, an optional map argument costs at worst one more keystroke to invoke, and it's simply a more straightforward and regular behaviour to build on top of.
I suspect that most of the Clojure APIs out there which use keyword varargs did so by imitation of Python and just overlooked the alternative of using a map argument, or really had an unsound obsession with concision.