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

+2 votes
in Errors by

If you just type "@1" is the repl, on previous versions you'll get an error that Long cannot be cast to IDeref. In 1.5, the error message is that it cannot be cast to java.util.concurrent.Future. This is because it assumes that anything that isn't an IDeref is automatically a Future. The deref method should generate a custom error stating that the type you've passed in is neither an IDeref nor a Future.

2 Answers

0 votes
by

Comment made by: gfredericks

Attached a patch that implements the old behavior (can't cast to IDeref), which strikes me as good enough considering the support for j.u.c.Future seems rather an edge case (being that clojure's futures are themselves IDeref).

The weirdest thing I did was to use clojure.core/cast to unconditionally throw a ClassCastException. Let me know if that's weird and I'll do something different.

by
I think throwing a ClassCastException isn’t ideal. IllegalArgumentException feels more appropriate as the function covers multiple interfaces (including the bounded variant with timeout).
0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1162 (reported by alex+import)
...