Use AFn.applyToHelper rather than IFn.applyTo in InvokeExpr.eval

Description

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)

Environment

None

Attachments

1
  • 23 Apr 2015, 12:59 PM

Activity

Show:

Details

Assignee

Reporter

Patch

Code

Priority

Created April 23, 2015 at 12:59 PM
Updated April 23, 2015 at 12:59 PM

Flag notifications