2009/2/22 Chouser <chou...@gmail.com>

>
> On Sat, Feb 21, 2009 at 5:36 PM, David Nolen <dnolen.li...@gmail.com>
> wrote:
> > My point is simply that whether something is immutable or not has nothing
> to
> > do with how that data structure is being used in the program.
> > Naming conventions signify usage.  You could write a pure Java
> > program and make it pretty darn functional. You would still want to
> > mark values that are logically treated as constants as such.
>
> Most named Vars are given a single value and this is never changed at
> all.  They are created with 'def' or some variation thereof, and then
> examined in various ways, but not given new values.  They are constant
> and they are named in the normal Clojure way: lowercase with dashes.
>
> Sometimes these Vars are changed later with another 'def', but this is
> meant to be a development or debugging technique, not something that
> should be incorporated into normal program logic.  Anticipating this
> kind of change (or not) shouldn't influence the name of the Var.
>
> Some named Vars are expected to be given a thread-local value with
> 'binding', and in even more rare cases then adjusted using 'set!'.
> This usage is unusual enough that the names of such Vars warrant the
> *earmuffs*.
>
> Even less commonly than any of the above is changing a Var's root
> value with 'alter-var-root'.  This is perhaps unusual enough that it
> warrants a naming convention to indicate that this particular Var will
> actually be non-constant at its root.
>
> Is there some other distinction that needs to be made?  Does logically
> constant mean something different from what I've described above?
>


+1

A constant value can be considered as a pure function with no argument, so I
totally agree that we can follow the same naming convention for constant
value than for functions.

So, to summarize my thought and rework the initial categorization attempt
made my Howard :

 * lowercase-names-with-dashes : constant values. Be there global functions
with zero or more arguments, functions arguments, names introduced by let.
When they are global functions, there are some ways to change their value in
Clojure, but this should be done only during development (e.g. for debugging
purpose).
 * lowercase-names-with-dashes inside asterisks : values that are thread
bound. Generally introduced as global vars, or very rarely via
'with-local-vars. Their value is generally re-bound via the 'binding special
form.


Note I added "lowercase" to "names-with-dashes", so that names without
dashes don't interfere with classnames (in java the convention for class
names is to begin with an upper case letter)

HTH,

-- 
Laurent

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