-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
Description
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)
gabriel-francischini