> What really puzzles me is that it doesn't seem to be generally
> regarded as idiomatic Clojure style to just use top-level (let)s for
> your "private" globals. This has lots of benefits:
> 
> - If you do this you can make them actually, genuinely private, rather
> than just marked as "please don't use this"
> - You get more self-documenting source code: (let [x 1] (defn foo []
> (...use x...))) is clear about how and where x will be used, while
> (def- x 1) (defn foo [] (...use x...)) leaves open the possibility
> that x is important all over the namespace.
> - You avoid runtime var-deref costs for constants that will never
> change.
> 
> I find this style so useful and readable that I'm curious why it isn't
> more popular in the community at large.

Top-level lets make it more difficult for tools to statically analyze code.

Of course said tools are largely hypothetical at present. :-)

Stu

Stuart Halloway
Clojure/core
http://clojure.com

-- 
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

Reply via email to