*earmuffs*
for things intended for rebinding (ie. are dynamic).
;; good (def ^:dynamic *a* 10)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why should they have any sort of naming scheme? Dynamic vars are unusual because their values can change. Atoms and refs remain the same, and even though inside their values mutate, they don't affect the outer var.
Also, if you have so many atoms in your program that it becomes hard to remember where they are, that would be another source of concern ;-)
Postfix @? Haven't pondered this before but I like the idea. Why should perl have all the fun?
&, $, and ! might be good to use as special naming characters for atoms/refs/agents, either as an initial char, a final char, or both, but I'm wondering whether anyone already has a naming convention that they use.
--
Ps. Note the nice symmetry between *foo* and @foo@.
On Dec 6, 2015 2:45 PM, "Nicola Mometto" <brob...@gmail.com> wrote:
>
> 'foo@ is not a valid symbol name
Oops. Maybe now is the time to make good on "other characters may be allowed eventually" (from the Reader doc.) I can't think of a good reason not to allow @ in symbols. Would it mess anything up?
(swap! !state conj :whatever)
And so on.
--
I write such code like this:(defn sdescriptive-name [] <many lines>)(def my-atom (atom (descriptive-name)))Where descriptive-name would describe the data shape or purpose.This way the atom is not obscured behind many lines of code and the data-generation is factored into a testable function with a hopefully self-documenting name.On Thu, 10 Dec 2015 at 10:27 Colin Yates <colin...@gmail.com> wrote:I know it is dangerous to make sweeping statements, but any solution to “a lot of code obscures meaning therefore do X” is often solving the wrong thing - the real problem is "a lot of code that obscures meaning” :-).I hope that doesn’t come across as condescending as I fear...