On Wed, 7 Jul 2010 18:53:39 -0700 (PDT) j-g-faustus <johannes.fries...@gmail.com> wrote:
> On Jul 7, 7:55 pm, James Reeves <jree...@weavejester.com> wrote: > > For the purposes of this discussion, let us assume that "foo" is a > > suitably unique library name, and it is highly unlikely there exist > > any other libraries with the same name. > > It sounds like Clojure doesn't have an idiom for namespace names yet, > so I guess we are free to make our own conventions. You're overlooking that one of the major benefits of Clojure is that it interoperates with other JVM languages. So any idiom it uses needs to have some assurance that it won't clash with an idiom used by thsoe other languages. Ditto for the CLR. The very first thing I did with clojure was grabbed a Java library - and all the things it depended on - and wrote some test code to play with it. > The Sun/Java notation has the advantage that it scales. Any short one- > element name convention will eventually clash, since there are only > that many TLAs available. That the Oracle/Sun/java way scales is a good reason to do it their way. Except that I notice that Sun doesn't do that: the libraries I've got from them are javax.comm, *not* com.sun.javax.comm (being renamed to com.oracle.sun.javax.comm, I suppose). > For CCW, a quick Google search tells me that it is an acronym for > * Complete Custom Wheels > * Countryside Council for Wales > * Carlisle Coating and Waterproofing > * Coastal Championship Wrestling > * etc. etc. etc. If I ever add AJAX widgets to bitchen' it's going to be the "Cool Clojure Widgets" library. Just 'cause. > I suppose most of those organizations do not ship Clojure code, at > least not yet :), but if Clojure grows to see widespread use name > clashes are inevitable. It will happen long before that for clojure users if they incorporate non-clojure libraries. > The Sun/Java convention is made to scale to the point where everyone > in the world can release their own modules without interfering with > each other. Just so long as everyone follows that convention. As far as I know, Sun didn't do anything to enforce that, or even to prevent people from shipping code in namespaces in a domain name they don't own. > The disadvantage is of course that you end up with names like > org.apache.http.client.params.ClientPNames/ > CONNECTION_MANAGER_FACTORY_CLASS_NAME > which gets old really quick if you have to type it a lot :) > > I would like to see a middle ground - somewhat less verbose than Java > but still long enough to scale to orders of magnitude more libraries > than today. Although aliases go a long way towards making long names > less of an issue. > > So perhaps something like > (com|net|org|edu).(author).(project) > where 'com' means 'commercial' (for sale), 'org' is open source, 'edu' > related to education and 'net' a general-purpose catch-all for > remaining cases. By picking the DNS TLD's, you're *asking* for collisions with the DNS namespace. Unless you want to use XXX, of course. The first component needs to be something that is 1) isn't likely to collide with a DNS namespace, and 2) isn't likely to be used by any other language. Given that Sun is using javax, something like "clojure.(author).(project)" would seem to be appropriate. That should be safe from the DNS namespace (unless it means something when transliterated into a foreign language) nor is a project in a language other than clojure likely to use it. Of course, if you google for "Mike Meyer", you'll find (on the first page I get from google) a photographer, an artist, a statistician, an online educator, an astrophysicist (I seem to be an intellectual bunch), a sports commentator, and a Canadian comedian who doesn't spell his last name right. At least the mass murderer has fallen out of the rankings. In the past, I've gotten party invitations meant for another Mike Meyer, been handed the wrong paycheck, been asked how my kids were (long before I had any myself), and once even collaborated with myself on extending the emacs MH-E package. So maybe that's not so good. Especially if your name is "Muhammad", "Chen", or "Smith". > This would make it > - org.weavejester.foo > and we can leave out github as a hosting detail. (As pointed out > earlier, the project could move to bitbucket next week.) > > What I don't like about the leading com/net/... is that we are wasting > an entire namespace element and several characters to distinguish four > cases, that's just two bits of information... As above, that namespace needs to be used to distinguish clojure from everything else that runs on the JVM. > A better alternative might be > (where).(who).(what) > - github.weavejester.foo > although tying the namespace up to a hosting provider doesn't seem > ideal either. Actually, the WWW consortium found out the hard way that using URL as namespaces for schema was a *bad* idea. They weren't supposed to actually be used to find the schema, but the www made them available that way, and people wrote code to use them. When the WWW realized that their servers were being ground to dust by people fetching the schemas, they moved them, and a lot of software quit working. If you're going to use a repo server as part of the name space, it must be clear that this doesn't mean that's where the project lives: it just provides a namespace for the library, and looking for sources or jars there is the *wrong* thing to do. > So perhaps just > (who).(what) > - weavejester.foo > which would get my vote today. If "who" and "what" are both suitably > unique today, the combination is unique squared and should be good for > a couple of orders of magnitude more growth. I don't believe either is suitably unique today, since you're not doing anything to distinguish this from *other* languages on the jvm. > It is also the convention used by the Clojure core, as in clojure.set, > clojure.xml etc. Clojure (like Java) gets a special pass: if you're writing in Clojure, you're using the Clojure (and probably some java) libraries, so you know that those namespaces are taken. <mike -- Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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