Hi Bartek,

In this case, I don't think `gen-class` has any part to play at all. All 
`gen-class` does is generate a class with stub methods that dispatch to 
Clojure functions by name.

What matters is an expression like `(.f this a)`. If the Clojure compiler 
can statically determine the types of `this` and `a`, it will emit bytecode 
to invoke the correct method directly. If it CANNOT determine the types, it 
will emit bytecode that uses Java's reflection APIs to find the appropriate 
method at runtime.

The Clojure compiler will never call the WRONG method, but the reflective 
version is much slower. You can check for reflection by running:

    (set! *warn-on-reflection* true)

in the REPL before loading/compiling your code. To prevent the reflection 
warning, you can add type hints to the symbols.

-S

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

Reply via email to