Mars0i <marsh...@logical.net> writes:

> I believe these statements are correct, but gen-class is complex and
> deftype use has some nuances, so I want to make sure I haven't missed
> something.

You have missed one possible approach – write a small integration class
in Java which delegates behavior to a parameterized something more
easily expressed in idiomatic Clojure (e.g., an `IFn` function or
`reify`d interface).

I’ve made this joke before, but: Java is a pretty solid DSL for writing
Java classes.  When you need a Java class which conforms to some
combination of Java-side abstract signatures (extending a base class,
AOTed for discovery by name via reflection, annotations, etc), in my
experience it is frequently/nearly-always easier to adapt from that
interface to Clojure in Java that it is to adapt to that interface from
Clojure in Clojure.

Some examples:

https://github.com/damballa/parkour/blob/master/src/java/parkour/hadoop/Mappers.java
https://github.com/damballa/abracad/blob/master/src/java/abracad/avro/ClojureDatumReader.java

HTH,

-- 
Marshall Bockrath-Vandegrift <llas...@damballa.com>
Principal Software Engineer, Damballa R&D

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to