Great post. I like it even though I disagree on some small points. :)
I find there are cases where careful use of :require :refer makes sense. I keep it to a minimum, and the deciding factor is usually that I'm using the function so much and so centrally in my namespace that whoever is reading it can be assumed to be aware of what the referred function is.
I find the point about unique namespace aliases insightful. However, my preference for namespace aliases is much terser—often involving single letters. I think I could be convinced on this issue.
I think his readability/compactness example falls apart if possible-states is named as a predicate, that is, valid-state? Then (when (valid-state? state) ...) is perfectly obvious. I don't need to know it's a set; I only need to know it's a predicate.
While I appreciate some of Nikita's pushback on terse idioms—e.g. "prefer (not (empty? coll)) over (seq coll)"—I think avoiding comp, partial, and so on is throwing the baby out with the bathwater. Those are awesome function-builders, and they only take a little getting used to.
I need to think about the "Don't spare names" section. On the one hand, extraneous names can create extra burden to figure out what they are and where they're used. On the other hand, his example is quite clear that these names are used only in his pseudo-thread context. The "omit names if the thing remains the same type" heuristic might convince me.
10
u/daveliepmann May 24 '17
Great post. I like it even though I disagree on some small points. :)
I find there are cases where careful use of
:require :refermakes sense. I keep it to a minimum, and the deciding factor is usually that I'm using the function so much and so centrally in my namespace that whoever is reading it can be assumed to be aware of what the referred function is.I find the point about unique namespace aliases insightful. However, my preference for namespace aliases is much terser—often involving single letters. I think I could be convinced on this issue.
I think his readability/compactness example falls apart if
possible-statesis named as a predicate, that is,valid-state?Then(when (valid-state? state) ...)is perfectly obvious. I don't need to know it's a set; I only need to know it's a predicate.While I appreciate some of Nikita's pushback on terse idioms—e.g. "prefer
(not (empty? coll))over(seq coll)"—I think avoidingcomp,partial, and so on is throwing the baby out with the bathwater. Those are awesome function-builders, and they only take a little getting used to.I need to think about the "Don't spare names" section. On the one hand, extraneous names can create extra burden to figure out what they are and where they're used. On the other hand, his example is quite clear that these names are used only in his pseudo-thread context. The "omit names if the thing remains the same type" heuristic might convince me.
Lots of good opinionated thoughts to chew on!