On Fri, Sep 18, 2009 at 4:45 PM, CuppoJava <patrickli_2...@hotmail.com>wrote:
> Hi, > After I shot myself in the foot again this morning by naming one of my > variables "cond" and then wondering why Clojure was complaining about > a simple cond form, I thought why don't we have capitalization > conventions that differ between variables and functions? > > Everything in Clojure is lowercase. Are people too opposed to variable > names beginning with an upper case character? > > In Java, names that begin with upper case characters denote classes, > but class names are much less often to be seen in Clojure. > > Thoughts? A decent IDE will alert you with syntax highlighting (NetBeans w/ enclojure does, in particular). It is a bit of a bother that many commonly desirable short-and-meaningful variable names would shadow clojure.core names or special forms: fn, map, seq, vec, key, value, and plenty more. I find myself often using names like f, m, s, k, and v, or similarly. Sometimes a more meaningful name still is possible, generally in higher level code; accounts-map for instance. In lower level code though, you may have say a function that does some kind of reduction over a map with a particular key. This function is agnostic to whatever higher purpose the map may serve; it's called by, rather than part of, the business logic. So what do you call its parameters? I wind up with f, m, and k; it's that or something like the-fn, the-map, and the-key and that seems verbose. This arises with any function that performs a generic transformation of data agnostic as to that data's business-logic purpose. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---