Watching the latest Rich Hickey talk, I wonder if the new & syntax in :keys/`:keys!` will be either a boon for helping people understand helix’s spread syntax or confusing, since they sort of do the opposite.
Example in Helix? (I ask b/c we're already using 1.13 in production with the new syntax and I'm curious about impacts to libraries etc)
I posted this and then afterwards, remembered & is already how dynamic arity functions are defined 😄
Helix allows you to merge a dynamic map into a static map like
;; create a new element with props `{:foo 1 :bar 2 :baz 3}`
(let [extra {:bar 2 :baz 3}]
(d/div {:foo 1 & extra} ...))
The macros (`$` and all the dom element constructors) emit code to efficiently construct a JS object of the static props and then dynamically merge in the additional map passed to the & key.it’s sort of a mirror of the rest params/new keys functionality
1.13 makes & invalid as a destructuring key, so maybe that will affect you?
A search of the Helix code suggests you don't use it that way, so I think you'll be fine.
Main thing is probably that :& is built in to destructuring somehow
Not :&, just &. {:keys! [a b & :c]} -- checks and binds :a to a and :b to b, and also checks :c (with no binding).
Prior to 1.13, if you had :& as a key and used {:keys [a b & :c]} you'd get four bindings:
> clj -M:1.12
Clojure 1.12.6
user=> (let [{:keys [a b & :c]} {:a 1 :b 2 :c 3 :& 4}] [a b & c])
[1 2 4 3]
user=>
> clj -M:1.13
Clojure 1.13.0-alpha9
user=> (let [{:keys [a b & :c]} {:a 1 :b 2 :c 3 :& 4}] [a b & c])
Syntax error compiling at (REPL:1:1).
Unable to resolve symbol: & in this context
user=>yeah i don’t imagine this will break anything, I was more pondering about extending the meaning of the & symbol to another place
it’s probably neither here nor there