Thanks Stuart. In the documentation for ns it says that "references can be zero or more of: (:refer-clojure ...) (:require ...) (:use ...) (:import ...) (:load ...) (:gen-class)". Also, using (:require...) twice in clojure (1.3) actually does work. Maybe there could be some clarification in the future... Since it seems quite natural to repeat the require clauses coming from languages where you always have to write "import" many times, I imagine other people are making the same mistake.
On Monday, March 5, 2012 5:15:47 PM UTC-5, Stuart Sierra wrote: > > Yes, it is incorrect, in both Clojure and ClojureScript, to repeat the > (:require ...) or (:use ...) forms in an `ns` declaration. > -S > > > On Monday, March 5, 2012 12:26:03 PM UTC-5, Aaron wrote: >> >> It seems that when I require two namespaces in a namespace definition, >> the clojurescript compiler misses the first require. I have a module >> that has a ns definition more or less like the following: >> >> (ns my-namespace >> (:require [lib1 :as l1]) >> (:require [lib2 :as l2])) >> >> Using clojurescript master (53ecf3cd3a), the compiled javascript for >> the above definition is: >> >> goog.provide('my-namespace'); >> goog.require('cljs.core'); >> goog.require('lib2'); >> >> The compiler misses the first require. If I switch the definition >> around so that it reads like this: >> >> (ns my-namespace >> (:require [lib2 :as l2]) >> (:require [lib1 :as l1])) >> >> again, the compiler misses the first require and the output looks like >> this: >> >> goog.provide('my-namespace'); >> goog.require('cljs.core'); >> goog.require('lib1'); >> >> However, if I just write: >> (ns my-namespace >> (:require [lib2 :as l2] >> [lib1 :as l1])) >> >> the javascript output references both libraries just fine. Is it just >> wrong to use multiple requires in clojurescript, or is this really a >> bug? If there is a general convention that must be followed then it >> would be good to document it because as a relative new-comer, it took >> me a while to find a workaround. >> >> Thanks! >> >> >> On Monday, March 5, 2012 5:15:47 PM UTC-5, Stuart Sierra wrote: > > Yes, it is incorrect, in both Clojure and ClojureScript, to repeat the > (:require ...) or (:use ...) forms in an `ns` declaration. > -S > > > On Monday, March 5, 2012 12:26:03 PM UTC-5, Aaron wrote: >> >> It seems that when I require two namespaces in a namespace definition, >> the clojurescript compiler misses the first require. I have a module >> that has a ns definition more or less like the following: >> >> (ns my-namespace >> (:require [lib1 :as l1]) >> (:require [lib2 :as l2])) >> >> Using clojurescript master (53ecf3cd3a), the compiled javascript for >> the above definition is: >> >> goog.provide('my-namespace'); >> goog.require('cljs.core'); >> goog.require('lib2'); >> >> The compiler misses the first require. If I switch the definition >> around so that it reads like this: >> >> (ns my-namespace >> (:require [lib2 :as l2]) >> (:require [lib1 :as l1])) >> >> again, the compiler misses the first require and the output looks like >> this: >> >> goog.provide('my-namespace'); >> goog.require('cljs.core'); >> goog.require('lib1'); >> >> However, if I just write: >> (ns my-namespace >> (:require [lib2 :as l2] >> [lib1 :as l1])) >> >> the javascript output references both libraries just fine. Is it just >> wrong to use multiple requires in clojurescript, or is this really a >> bug? If there is a general convention that must be followed then it >> would be good to document it because as a relative new-comer, it took >> me a while to find a workaround. >> >> Thanks! >> >> >> -- 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