I've been searching for some best practices when it comes to wrapping 
existing Java libraries to make them more "clojurized."
Unfortunately I've not found much.
While I know enough to make something that works for me, I'd like to write 
it in such a manner that it can be used (and read) by others
and not make them cringe in doing so.

My first attempt was to simply write function wrappers around the java 
interop calls.
This worked fine and was maintainable.  Then I discovered 'lein check' and 
saw a whole lot of warnings about reflection.

This led me to my second attempts.  This time I wrote multimethods to 
dispatch on type of arguments and in each defmethod argument list
I gave type hints for each argument.  This indeed resolved the reflection 
warnings, but I fear that the resulting code is rather messy and not
too pleasant to read either.  This made me wonder if all the type checking 
I'm doing in the multimethod dispatch function isn't just as bad as
the reflection that would take place.

For my purposes and this particular library I'm not really concerned with 
performance, yet someone else may be.  Can anyone offer me some
advice on how best to approach a project like this?

Kind regards,
Michael

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