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

0 votes
in Errors by

('+ 1 2) ;; return 2 because it is treated as (get 1 '+ 2)

Whilst this is "consistent" once you know the lookup behavior, it's confusing for Clojure newbies and it seems to be a non-useful behavior.

Proposal: modify Keyword.invoke() and Symbol.invoke() to restrict first Object argument to instanceof ILookup, Map or IPersistentSet (or null) so that the "not found" behavior doesn't produce non-intuitive behavior.

This should track CLJ-1107.

3 Answers

0 votes
by

Comment made by: zjhmale

a patch to fix this issue

0 votes
by

Comment made by: zjhmale

for now

user=> ('+ 1 2)
IllegalArgumentException class java.lang.Long is not lookupable: clojure.lang.Symbol.throwNotLookupable (Symbol.java:127)
user=> (:+ 1 2)
IllegalArgumentException class java.lang.Long is not lookupable: clojure.lang.Keyword.throwNotLookupable (Keyword.java:103)

and everything else works fine

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