On 20/06/13 10:59, Colin Fleming wrote:
> Because this tests for something different - that the element is an
> instance of ClSymbol. It's not testing the same thing as the core
> version. I qualify it (psi/symbol? in the examples above) to
> distinguish it from the core one.
>
> Basically, I'm trying to use definline to allow me to have a more
> Clojure-y API without having the performance hit of tons of tiny
> function calls.
>
> I agree that this is unlikely to be a bug in Clojure and is probably
> something I'm missing, but I can't figure it out.
right I see...so if ClSymbol is a defrecord/deftype I don't see anything
wrong with your code...when you do (in-ns 'plugin.psi) do you get a
warning that core/symbol? is being replaced by psi/symbol? ?
what you tried on your repl works fine on mine:
user=> (defrecord FOO [a])
user.FOO
user=> (definline foo? [e]
#_=> `(instance? FOO ~e))
#'user/foo?
user=> (foo? 2)
false
user=> (filter foo? [1 2 3])
()
user=> (filter foo? [(FOO. 1) 2 3])
(#user.FOO{:a 1})
Did you try 'lein clean' to get rid of already compiled classes? I'm
suspecting you have different versions of the same class lying around
because of what you said about compiling and recompiling...
Jim