Skip to content

Instantly share code, notes, and snippets.

@timmc
Created April 2, 2011 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timmc/899696 to your computer and use it in GitHub Desktop.
Save timmc/899696 to your computer and use it in GitHub Desktop.
When compiled: "java.lang.ClassCastException: test.core.Person cannot be cast to test.core.Person"
(ns test.core)
(defrecord Person [name])
(def fred (Person. :fred))
(def test-direct ; fine
(.name ^Person fred))
(def test-no-hint ; fine
(#(.name %) fred))
(def test-wrapped ; compile error
(#(.name ^Person %) fred))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment