clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
Ivan Koz 2020-01-26T07:32:15.007200Z

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);
    }

cfleming 2020-01-26T09:27:28.007800Z

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 Koz 2020-01-26T10:10:53.008Z

interesting, thank you Colin

2020-01-26T12:06:50.008200Z

thank you both!