There's absolutely no shame in, where appropriate, writing a dash of Java if your Java interop requirements are simultaneously specific and unshakable. You could write a Java class with a single static factory method that returns an instance of the deftype class and that does whatever initialization/setup you need.
Alternatively, you can write a nullary factory function in Clojure, and call that directly from Java all day long. In any case, neither deftype nor defrecord are intended to be (or will they ever be) fully-featured interop facilities. gen-class certainly comes the closest, which is why it's been recommended. Cheers, - Chas On Jun 29, 2011, at 1:08 PM, Alex Rozenshteyn wrote: > I asked on IRC, I asked on SO[1] and I'll ask here as well, because this > seems like a question to which the answer shouldn't be "Just use gen-class". > > The summary of my predicament: I need a Java class that implements an > interface, has a nullary constructor that performs initialization, and has > something resembling member fields. > > [1]: > http://stackoverflow.com/questions/6515162/add-constructor-to-deftype-created-class > > -- > Alex R -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
