On Nov 10, 2008, at 8:48 AM, Robert Lally wrote:
> One of the many things that I really like about Clojure is that it > abandoned Lisp tradition where it was pragmatic to do so. One of the > prime examples for me was the use of first and rest rather than car > and cdr. Sure, I can read code with car and cdr but it never really > communicated that well; I always had to go through a translation > step in my head. It's important to note right away that car and cdr aren't abbreviations for anything more meaningful than car and cdr. > With this in mind it surprises me ( and disappoints a little ) that > there are still abbreviated function names in many places - aget, > aset, assoc, conj, coll?, comp, and so on. Is there any need for > this in the 21st century? I think so, but I understand this is somewhat subjective. It is useful to look at the 'competition' here (from random other languages): array-get -> [] associate -> put conjoin -> add compose -> . I don't see people coming from a language where array access is [] feeling good about the verbosity of array-get. put and add have imperative connotations that don't fit what assoc and conj do, so using them would only confuse people more. > The trade off between meaningful method names and number of > characters typed doesn't seem to be a good one from my perspective; > particularly as IDE support matures and you will only need to type > 'asso' to have the IDE expand the function name to 'associate' for > you. IDEs can be great, but having to rely on them is a real problem. People stumble over Lisps due to editors without adequate paren matching, and if my experience with Clojure users is a guide, people tend to try to stick with the editor they already know, leaving them waiting for specific language support. Adding completion to the 'things your editor must do before you can write Clojure effectively' sets a high bar. > Using full words as function names leads to more readable code .. > which can only be a good thing. They do only to a point, and then the code gets larger and harder to scan, lines spill etc. > I'm not suggesting that terseness is bad, merely that I don't > believe the trade off is worth it in this case. I've shown Clojure > to a number of people and the Lisp derived syntax coupled with > abridged names makes it harder for people to comprehend, makes it > less likely that on first encountering a piece of Clojure code that > they'll be able to understand it, and so make it less likely that > I'll get to write Clojure for a living ... which makes me sad. Well, people have to learn something new when they approach a new language. I'm not sure associate or conjoin would be more readily understood without some background on persistent immutable data structures. But at least it's not a lot of arbitrary syntax and associativity rules, and most of the short names are true abbreviations. Short names are one way Clojure can compete for brevity with languages that get their brevity from syntax. IMO, it's more approachable than Haskell, Erlang, Scala or any of the ML variants. array-get, associate, conjoin and compose etc are all still available. I wonder - would people use them if they were provided as aliases? I know I wouldn't. The vocabulary of seqs and collections is so small. While I appreciate the approachability argument, a language is ultimately for its practitioners. I imagine there are those that wish assoc/conj/apply et al were even shorter, or dedicated symbols... Since I don't hear this argument too often, I image Clojure is striking an acceptable balance. What does everyone else think? Rich --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---