Skip to content

Conversation

@frenchy64
Copy link
Owner

@frenchy64 frenchy64 commented Jan 7, 2023

Is the emitArgs call still appropriate for invokeStatic?

This is broken, I think because of https://clojure.atlassian.net/browse/CLJ-1865 the recursive calls needed for a protocol to lookup its own cache are not directly linked. Can we stash the cache somewhere else?

(defprotocol Foo (pfoo [this]))
(defn libfn [x] (pfoo x))
(extend-protocol Foo String (pfoo [_] :dude))
(libfn "hello")
(alter-var-root #'user/pfoo (fn [old] (fn [this] (prn :this) (old this))))
(libfn "hello")
Execution error (NullPointerException) at user/pfoo (REPL:1).
Cannot invoke "clojure.lang.MethodImplCache.fnFor(java.lang.Class)" because "cache__8012__auto__2146" is null

Idea: start from scratch, this time try and broaden the Fn's that canBeDirect. For protocols, we need to:

  1. allow (.__methodImplCache this) without counting towards "this" usages, and
  2. allow functions to close over other directly linkable functions.

@frenchy64 frenchy64 changed the title Direct linked protocols Directly linked protocols Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants