I'm extremely internally torn regarding kwargs. I use them a lot; I know they hinder composability; but every time I go back to straight maps for these kinds of things I really don't like all the extra noise characters and go back to kwargs.
I feel like I really should be using regular maps for all the good reasons listed, but in practice I don't. Honestly, I don't usually run into the composability issues too often, so I'm getting by "ok" with my indulgence in kwargs, I suppose. I especially dislike that my non-kwarg fns no-longer can elegantly accept no options. Let me illustrate: (defn foo [& {:keys [a b]}] [a b]) (foo :a 1 :b 2) (foo) (defn foo [{:keys [a b]}] [a b]) (foo {:a 1 :b 1}) (foo {}) ;; <-- unpleasant to my eyes, let me reimplement foo (defn foo "This is also pretty gross" ([] (foo {})) ([{:keys [a b]}] [a b])) So, yeah, I'm pretty torn. I like the option of having kwargs for the outer API shell, and explicit option maps internally. I've played with that a little as well at work to some "ok" success. Alex On Tue, Apr 29, 2014 at 8:41 PM, James Reeves <ja...@booleanknot.com> wrote: > On 30 April 2014 03:54, Sean Corfield <s...@corfield.org> wrote: > >> I still think the keyword argument approach is far more readable to >> _users_ > > > Really? It's only an omission of two braces. While readability is > subjective, I'm not sure how that can be considered to be *far* more > readable. > > From a purely practical perspective, explicit maps are generally a lot > easier to work with. To my mind the disadvantages of keyword arguments > often outweigh the small presentational benefits they have. > > - James > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.