On Fri, Oct 3, 2008 at 2:00 PM, Stuart Halloway <[EMAIL PROTECTED]> wrote: > > Does this make sense? > > user=> (let [x Integer] (.getName x)) > "java.lang.Integer" > user=> (.getName Integer) > java.lang.NoSuchFieldException: getName
I hereby nominate this for the Most Asked question in Clojure. But just because it gets asked doesn't mean it's easy to search for and find the answer, so I'm not blaming you at all. In Java, you can't say Integer.getName(), right? Because the Integer class doesn't have a static getName() method. Therefore you can't say (.getName Integer) or (. Integer getName) or (Integer/getName) in Clojure. Instead in Java you would have to say Integer.class.getName(), right? But Clojure gets that class object for you automatically anytime you try to pass it around, such as when you store it in x in your example. So that's convenient, but sometimes you need to force it a bit, by doing something like (.getName (identity Integer)) See also: http://clojure-log.n01se.net/date/2008-09-06.html#09:26 http://clojure-log.n01se.net/date/2008-08-28.html#21:42 http://groups.google.com/group/clojure/browse_thread/thread/68490633c254dbd1 --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---