On Nov 24, 1:24 pm, Ken Wesson <kwess...@gmail.com> wrote: > I gave some thought to the Integer vs. Int32 issue. > > I think what would help here is a way to alias classes when :importing them. > > It would require tweaking the ns macro and possibly parts of the > runtime. The outcome would be to allow something like > > (ns foo > (:import (java.util.concurrent > AtomicBoolean (ConcurrentHashMap :as CHM) AtomicInteger))) > > (defn make-default-chm [] > (CHM. 12 12 12)) > > ... > > Handy so far for abbreviating some longer classnames, and the > application to CLR portability is apparent: > > (ns foo > (:import (System (Int32 :as Integer)))) > > In theory, you'd just add this import to make code full of ^Integer > hints compile under ClojureCLR. You'd still need two versions of the > source file though, a CLR version with the import and a JVM version > without. > > But then why not go even further and have the ns macro able to tell > what platform it's on? > > (ns foo > (:import-jvm (package1.package2 BarBaz as BBaz)) > (:import-clr (Package3.Package4.BooBaz as BBaz))) >
Regarding enhancements to ns/import/etc.: Not to speak for Rich, but he has in the past been resistant to modifications to these elements to support CLR vs JVM. Regarding Int32 vs Integer: They are really not equivalent. Int32 is equivalent to Integer/TYPE or a ^int type hint, not to java.lang.Integer. There is no CLR equivalent to the JVM Integer, Long, Number, etc., a fact which is currently cause me no end of problems as I try to incorporate into ClojureCLR all the compiler work RIch &co have done for 1.3. In fact, with 1.3, you will not be able to provide Int32 type hints on fn args or return values. CLojureJVM in 1.3 disallows primitive type hints in these places, wiping out ^int (JVM) and ^Int32 (CLR). You might find this discussion relevant: http://groups.google.com/group/clojure-dev/browse_thread/thread/6f9c9b7f36ae3134 -David -- 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