Yeah, gen-class is the thing. Proxy, well, proxies, but genclass
produces a statically compiled ahead of time class. It's a real Java
class, so yes, you can use it from Clojure like any other Java class.

Genclass is a little more painful than proxy, but probably a little less
painful than having a combined Java/Clojure build.

Phil

Anvar Karimson <an...@karimson.com> writes:

> Is that via gen-class? I have to admit that I am not very familiar with 
> gen-class, is it still possible to use the class from Clojure?
>
> Yes, that is probably the most pragmatic choice, premature optimization and 
> all that.
>
> On Friday, 4 April 2014 15:03:00 UTC+1, Phillip Lord wrote:
>>
>> Anvar Karimson <an...@karimson.com <javascript:>> writes: 
>> > I am trying to understand what the best course of action would be in the 
>> > following scenario: 
>> > 
>> > I have a Java base class that I need to extend. The class is fundamental 
>> to 
>> > my application and will be running fairly hot compared to other bits of 
>> > code in the application. Therefore I want it to execute as fast as 
>> > possible. The way I see it there are two options; 
>> > 
>> > 1) Use proxy 
>> > 2) Create a class in Java that provides the glue between Java and 
>> Clojure 
>> > and removes the need for extending the base class in Clojure. 
>> > 
>> > I would prefer to use option 1 but I am a little bit worried about the 
>> > performance implications of doing so, especially adding a level of 
>> > indirection by using map-lookup for accessing methods so I suspect I 
>> will 
>> > have to go with option 2. 
>> > 
>> > Any recommendations or alternatives? 
>>
>> Or Option 3, create a class in Clojure which extends the Java. 
>>
>> My suggestion, try number 1 which is easy, then performance test it. 
>>
>> Phil 
>>

-- 
Phillip Lord,                           Phone: +44 (0) 191 222 7827
Lecturer in Bioinformatics,             Email: phillip.l...@newcastle.ac.uk
School of Computing Science,            
http://homepages.cs.ncl.ac.uk/phillip.lord
Room 914 Claremont Tower,               skype: russet_apples
Newcastle University,                   twitter: phillord
NE1 7RU                                 

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