Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by

Because of implementation details of how def forms are compiled, invokations in its args are evaluated using applyTo rather than directly using the invoke method. This forces IFn implementors to implement applyTo even when not necessary.

The proposed patch changes InvokeExpr.eval to use AFn.applyToHelper, so that invoke rather than applyTo is used when possible.

Example of currently failing code that will work with patch:

user=> (deftype x [] clojure.lang.IFn (invoke [_] 1)) user.x user=> (def a ((x.))) AbstractMethodError clojure.lang.Compiler$InvokeExpr.eval (Compiler.java:3553)

1 Answer

0 votes
Reference: https://clojure.atlassian.net/browse/CLJ-1715 (reported by bronsa)