On Tue, Dec 7, 2010 at 12:28 PM, Mike Meyer <mwm-keyword-googlegroups.620...@mired.org> wrote: > On Tue, 7 Dec 2010 02:58:11 -0500 > Ken Wesson <kwess...@gmail.com> wrote: >> On Tue, Dec 7, 2010 at 2:15 AM, javajosh <javaj...@gmail.com> wrote: >> > Mike also points out that things that aren't functions (not used in >> > that context) can't be aliased with def or use. >> >> Really? >> >> user=> (def a 3) >> #'user/a >> user=> (def b a) >> #'user/b >> user=> b >> 3 > > This one I flubbed, because my vocabulary failed me. There are three > classes of values that can work when they show up in the first > position in an executable expression: > > 1) Functions, which can also be passed to higher order functions. > 2) Macros, which can't, but can be aliased by def or use. > 3) Java interop things (#6 6 & 7 on his list), which can't be aliased > by def or use.
Ah, it's inability to alias Java methods and classnames that bugs you. Actually, that bugs me too and I proposed alterations to the ns macro recently to allow that (with an eye to also making it easier to write code that works on both clojure-CLR and clojure-JVM, as there are some cases where C# and Java have nearly identical-semantics classes with different names). But yes, I think it would be nice to be able to alias at least classnames using at least the import/:import forms. (I don't object if the aliasing isn't dynamic; it isn't be for macros either. That is, it would be ok if you couldn't (let [x Integer] (x. 278)) or anything like that. Some cases where you'd like to pass a class as a parameter can be handled with multimethods or other means, for the most part; or passing the java.lang.Class instance itself around and using reflection.) -- 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