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.
My hope is that it encourages faster adoption of Clojure 1.11 b/c folks will want to take advantage of this feature.
If we'd had this feature back in, say, the 1.3 or 1.4 days, I wouldn't have needed to change the whole API of clojure.java.jdbc to make it easier to use (i.e., to make calls more composable)!
If this feature was introduced in 1.3 or 1.4, it would have made perfect sense. Now that everyone has been using the options map style for years to solve this problem, it feels a bit out of place – but I suppose if you take a long-term view it makes sense.
I wonder how this affects the performance and function specs though.
The change also affects destructing in lets (as it should):
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.