Hi everyone, I'm looking to get some opinions on code style. Specifically, I like to write my code in a top-down.
What I mean by that is that within a file the highest-level functions sit at the top, and are implemented in terms of lower-level functions further down. The idea is that through sensible naming, a reader should be able to stop reading at any point and still know what's going on. I was recently watching the prismatic schema presentation from the 2013 conj, and noticed they too promoted having a "public" section at the top of the namespace. The problem now is because of the single-pass nature of clojure's evaluation - simply writing code like this doesn't actually work. There's a few approaches i've seen from reading other's code: 1. Have an "impl" namespace which contains all of the helper functions for the public "interface" 2. Make use of (declare) forms where necessary to improve forward readability 3. Don't worry about source order, just have the api functions further down the file and live with it Some other options I considered include making really heavy use of (declare), or even defining some sort of (eval-reversed) macro which runs the code backwards. I'd like to know if people are experiencing this issue, and how you all are resolving it? Cheers Glen -- 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.