This is an known existing issue. Using :require to important constructors just doesn't make sense.
2 patches I think could help here: 1) support for :import 2) support for :require w/o :as Anyone game to submit some fixes? David On Thu, Jul 28, 2011 at 10:41 AM, Marko Kocić <marko.ko...@gmail.com> wrote: > Hi all, > > When dealing with ClojureScript and Closure library it happens pretty > often that Closure namespace is in the same time constructor for some > object. > > Take a look for this example: > > (ns notepad > (:require > [goog.dom :as dom] > [goog.ui.Zippy :as Zippy])) > > First, require forces me to require goog.ui.Zippy as Zippy and later in > the code I have to use fully qualified name instead of provided one. > > This works > (goog.ui.Zippy. headerElement contentElement) > > This doesn't work, since Zippy is namespace declaration > (Zippy. headerElement contentElement) > > I know that we can't have both namespace and function with the same name, > but this is pretty frequent situation in Closure library, and is a bit > awkward. > One solution would be that namespace :as symbol is specialcased so that > without namespace prefix Zippy and Zippy. works like a regular function, > and when in place of namespace prefix, it works as a namespace prefix. That > would be pretty in line with Closure library itselfi. > > Then we would be able to use > (require [goog.ui.Zippy :as Zippy]) > (def z (Zippy. "ttt" "sss")) ;; same as calls goog.ui.Zippy. > (Zippy/someMethod x) ;; same as goog.ui.Zippy > > What would be your proposal for this? > > -- > 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 -- 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