On Sat, Nov 21, 2009 at 8:47 PM, David Brown <cloj...@davidb.org> wrote:

> On Fri, Nov 20, 2009 at 03:54:45PM -0800, Mike Hinchey wrote:
> >It's the . special form that makes the difference.  In (. System
> >(getProperty)), the dot interprets System as a class and looks for a
> static
> >method (at read/compile time).  With (identity System), System resolves to
> a
> >value, a Class object, returned by identity, then your outside dot looks
> for
> >a getProperty instance method on that object(fallback to reflection, which
> >fails) - it's like writing System.class.getProperty in java.  There is no
> >syntax for clojure to lookup a static method on a dynamically resolved
> class
> >object because that is inherently reflection - dot is not about
> reflection,
> >though it will do it as a last resort.
>
> So, if I've acquired a dynamically resolved class and want to invoke a
> static method, is my only choice to manually use reflection?


No. You can also use eval, or if the class name is resolved by
macroexpansion time, a macro.

My preference order would be

macro (if applicable) > reflection API calls > eval

-- 
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

Reply via email to