This is unfortunate.  I certainly can write a Java class and I expected 
that would be the answer.  The question for me is whether, as a group, we 
see any value in having a consistent interface with the JVM.  One could 
argue that Clojure does not need any of the interop features it already 
has.  In fact, one might argue that all interop should occur by invoking 
pure Clojure from Java only but I hope most of us would agree that would 
not a very satisfying outcome.  The Clojure in Clojure work being done 
gives me hope this is going to change.  A Clojure compiler written in 
Clojure would almost certainly need to be full (or more fully) featured.

I like Stuart Sierra's quote (Twitter):  "Using Java libraries is idiomatic 
Clojure", and this is true for a lot of us using Clojure.

jbs

On Monday, April 14, 2014 1:10:47 AM UTC-7, Colin Fleming wrote:

> gen-class really isn't suitable for doing complicated interop like 
> annotating fields. It's heavily oriented towards a single means of managing 
> state, which is a single field generally containing an atom, which in turn 
> contains your actual state in a map or similar. If you really need multiple 
> fields you can use deftype/defrecord, but they come with different 
> restrictions - no inheritance, don't require their namespace on class init 
> which is required for many use cases where you might want field 
> annotations. I'm also not sure if their fields can be annotated. 
>
> In general when you start needing that level of interop, the easiest thing 
> is just to write a Java class and call into Clojure from there as required.
>
>
> On 14 April 2014 14:28, Jon Seltzer <seltz...@gmail.com <javascript:>>wrote:
>
>> There are many Java APIs that expect client APIs to annotate fields but 
>> Clojure does not support annotations on fields.  Is there any plan to add 
>> support?
>>
>> And one tangential question:  Is there any consideration of adding 
>> gen-class support for multiple fields instead of just one?
>>
>> jbs
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> 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+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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