On Fri, Jan 23, 2009 at 7:33 PM, Matt Moriarity <matt.moriar...@gmail.com>wrote:
> > 1) "use" and "require" differ in that use does what require does, > loads a library, but it also refers to the symbols in that lib in the > current namespace. So essentially if you want to use > clojure.contrib.def/defvar, if you (require 'clojure.contrib.def), you > would have to say (clojure.contrib.def/defvar ...), not if you use "as". so I still don't get why the two concepts can't be unified. > whereas if you did > (use 'clojure.contrib.def), you could then do (defvar ...) > > > 2) dots separate portions of a namespace. they are the same as how > dots separate java packages. Slashes separate the namespace and the > symbol name when you refer to symbols. they are not included in the > name of a namespace (and can't be). > This seems like it should be the other way around. Slashes are what my file system uses. I guess I'll just try to remember this stuff. Ah hah! I finally understand something. See this is what would really help in the explanation. Something like, "In Java, each file defines only a single outer class, which must have the same name as the file. This simple approach means that there is never any confusion that the last section refers to a class in a given package. Clojure trades simplicity for flexibility. To specify one of the many top-level symbols provided in a namespace, a slash is used to separate it from the namespace" Did I say that right? > 3) yes namespaces can be nested. that's the purpose of the dots, to > separate levels of nesting. So it's an error if a file specifies the wrong namespace for where it is in the project hierarchy? Thanks again. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---