plumatic / plumbing

Prismatic's Clojure(Script) utility belt
1.49k stars 107 forks source link

Some minor feedback #10

Closed clojens closed 11 years ago

clojens commented 11 years ago

Since you guys were asking for explicitly a few times, I figured I should at least write a few words on my experiences with plumbing so far. Partially, without knowing, I had already noticed a few of these patterns as well and with that grew a feeling your probably described best already as:

While Clojure's built-in destructuring is generally great, it leaves some things to be desired when we're only concerned with destructuring nested maps with keyword keys, and want to make heavy use of extra features like required keys or default values:

I hate me too! but I so want to say that. I have to admit, the way graph was setup, I probably wouldn't even have thought about that anytime soon, so it was a great discovery when I learned about your tool (and why I can spend so many hours in a software landscape scouting solutions, fearing I'd miss out on greatness floating around hyperspace).

One of the problems I was trying to tackle in a elegant fashion was the composition of Clojure web pages using hiccup and garden DSL in syntax-quoted or parsed/compiled forms, that I could more easily transform and pipe through decision nodes without writing, indeed, huge functions and let bodies. So one challenge that kept nagging me was how to do it all together in a more terse fashion than Clojure currently does with the whole destructuring/defauls/keys. Plumbing is definitely filling a niche here (I'm sure more people would use it if they knew about it) that at least I myself am going to keep using for a long while, or so I suspect.

Anyway, I've scoured the README of defnk/fnk and thing you guys nailed it on the head with the pro/con lists - I recognize those same points you make and somehow I wonder, if there is a clean solution 1,2,3. So I guess my feedback is: I have nothing I would change/improve at the moment that would be better. Oh well, enough time to let it sink in. Overall I'm very content with the result so far, that's an understatement probably. Heck I was even going to settle on the verbose/repetitive Clojure syntax as a fact of life and go on with it, although I was tempted to construct at least a macro to cover for some of it. That being said, I can conclude graph/plumbing even just being in existence as it is today, makes me a happy camper.

Thanks for the great work you've done so far, keep it up!

oh. One thing I didn't read in the documents (might be there somewhere) but probably going to experiment with today to see if/how easy it is to use defnk and hang them in a graph later on? Would it pick up on the same arguments from different defnk and treat them as one? Time to experiment some more and less writing/talking.

Cheers, Rob

clojens commented 11 years ago

And to answer myself: it works great with combining input from different defnk and it picks up the similar named keys/arguments. Sweetness!

w01fe commented 11 years ago

Hi Rob,

Thanks for the detailed feedback! It's really great to hear about how you're using plumbing, and we're especially interested in learning about any pain points you run into. It would also be great to learn more about your use case -- and if you wanted to do a blog post about it, it might be interesting for us to cross-post or promote it.

If you figure out a cleaner solution to destructuring, we'd love to hear it!

As you mention, (defnk name ...) is basically just (def name (fnk ...)) so no conflicts there. For large-scale hierarchical graphs we have a system using instance to prevent name collisions and provide meaningful parameter scoping -- we plan to elaborate on that further soon, if it's of interest to you please let us know.

Cheers, Jason