Fork me on GitHub
#clojure-dev
<
2020-01-26
>
Ivan Koz07:01:15

Can somebody explain why do we have two invoke for the functions in an emitted bytecode, and why do we call static function from the instance method?

@Override
    public Object invoke(final Object coll) {
        return invokeStatic(coll);
    }

cfleming09:01:28

My understanding is that invoke() is the function that implements the IFn interface, and it just calls invokeStatic(). Normal calls call that method, but if you have direct linking on during compilation then functions calling your function will just directly call the static method instead, bypassing the var. This is more performant, but means that you can’t update the definition of your function at the REPL.

Ivan Koz10:01:53

interesting, thank you Colin

sogaiu12:01:50

thank you both!