Python 3.10 introduced a canonical destructuring syntax with match. I think we should change the existing clojure like syntax to align with the syntax introduced by Python match which is already used by our existing match implementation.
Here's what I had in mind.
(let+ [{"a key" a-sym {"a" [{:keys [b c d]} :as nested e f #* rest]}} some-big-dict]
[a-sym b c d nested e f rest])
This has key and binding symbol swapped compared to clojure, but Hy isn't Clojure 🤷♀️ and I like the consistent syntax with our existing match implementation. the only addition here is the :keys option. Which, looks up by string keys and maintains the idiom of keywords being arguments not identifiers themselves (even though there's nothign stopping you from destructuring keywords here or in match)
Python 3.10 introduced a canonical destructuring syntax with match. I think we should change the existing clojure like syntax to align with the syntax introduced by Python match which is already used by our existing
matchimplementation.Here's what I had in mind.
This has key and binding symbol swapped compared to clojure, but Hy isn't Clojure 🤷♀️ and I like the consistent syntax with our existing
matchimplementation. the only addition here is the:keysoption. Which, looks up by string keys and maintains the idiom of keywords being arguments not identifiers themselves (even though there's nothign stopping you from destructuring keywords here or inmatch)