Hi Herwig,

thank you, you are probably right, but it writing new classes solely for 
that purpose seemes a bit too tedious task.

I found another solution: pre-load problematic classes without initializing 
them, and explicitly register them in namespaces:

(.importClass (clojure.lang.Namespace/findOrCreate 
'my.name.space)(Class/forName "my.problematic.Class" false 
(clojure.lang.RT/baseLoader)))


the class then may be as usual referenced as symbol in static metod call 
function (but not in macros).

IMHO it would be nice if Clojure used classes uninitialized until it is 
necessary.

Regards,
Vladimir

On Thursday, December 6, 2012 9:02:52 PM UTC+4, Herwig Hochleitner wrote:
>
> In clojure, as in java, you can compile against a stub class and run 
> against the real class with the same signature.
>
>
> 2012/12/6 Vladimir Tsichevski <tsich...@gmail.com <javascript:>>
>
>> Hi,
>>
>> I'm using CCW to compile Clojure to java classes.
>>
>> I have to compile a static class method call like this:
>>
>> (MyClass/myMethod arg1 ...)
>>
>>
>> To compile this the compiler needs to load the MyClass class. The problem 
>> is that in my case some classes can only be loaded in the running 
>> application. So the compilation fails.
>>
>> My current work-around is:
>>
>> (clojure.lang.Reflector/invokeStaticMethod
>> "full.name.of.MyClass"
>> "myMethod"
>> (object-array [arg1 ...]))
>>
>>
>> Does anyone knows more elegant solution?
>>
>> Regards,
>> Vladimir
>>
>> -- 
>> 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 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