Function that accept named arguments not compatible with new style of call in Clojure 1.11 Alpha 1


Several API functions in data.json accept a sequence of named (keyword) arguments.

Clojure 1.11.0-alpha1 adds a new feature that allows named arguments to be passed as a hash map or as named arguments (or a mixture).

Unfortunately, data.json uses & options in the arglists and then turns that into a hash map inside the functions so it is not possible to invoke these functions with just a hash map on Clojure 1.11.

If they used more traditional destructuring, such as:

This destructuring will accept named arguments or – on 1.11 – a hash map, and it will also bind options to a hash map of the arguments so there's no need for apply array-map any more to create a map from options when merging with the defaults.




Alex Miller
March 27, 2021, 12:40 PM

applied patch

Alex Miller
March 27, 2021, 12:32 PM

Although I guess the downside of that is it would require 1.11.

Alex Miller
March 27, 2021, 12:31 PM

Another option here is to use the new 1.11 function `seq-to-map-for-destructuring` which is designed for use cases where you are emulating destructuring, which might be better for performance.



Alex Miller


Sean Corfield