On Sunday, December 6, 2015 at 5:52:02 PM UTC-6, Glen Mailer wrote: > > I saw some sample code that prefixed the atom name with a ! recently, > seemed to look sensible to me. > > (swap! !state conj :whatever) > > And so on. >
This idea is conceptually elegant, since the marker, !, is the same as the related function suffix. I worry that having two bangs with a space between them, as in the swap! example above, is a little bit visually confusing. Also, I wonder whether placing @ next two another non-alphanumeric character is visually confusing or messy. As an experiment, I just started using & as a suffix for variables whose values are atoms.: (def state& (atom 1)) (swap! state& inc) @state& Using only a suffix character means that you don't have a punctuation character next to @, which I prefer. (I wouldn't want to use ! as the suffix for variables that are not functions, though. (swap! state! inc) potentially very confusing. It's not that someone reading it couldn't figure it out, but if I saw that, I'd have to think for a second, and then keep remembering that state! is not a function.) It occurred to me that I've seen both & and $ used in some languages to suggest pointer dereferencing, so there's some vague harmony to using one of them as indicators as markers of statefulness. "Ampersand" sounds vaguely like "atom". If one wanted to have separate marker characters for atoms, refs, and agents, maybe & is a good choice for atoms. Not sure it's necessary to have different conventions for these three distinct uses, though. -- 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.