On 2 Jun 2010, at 21:10, Mike Meyer wrote:

If your class has multiple constructors with different arity, there are ways to look up the right constructor using reflection, but I have forgotten the details already.

Can you let the fn call figure that out for you? Like so:

   (apply (fn ([p1 p2] (new Connection.Configuration p1 p2))
               ([p1 p2 p3] (new Connection.Configuration p1 p2 p3)))
           params)

I realize that reflection is probably better in this case, but was
wondering if this would work.

I think it should, though I didn't try. Obviously you would make that function by a macro, so it's in fact a viable alternative to reflection.

Konrad.

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