So this has just happened to me again: Clojure 1.5.1 (plugin.psi/symbol? 2) => false (filter plugin.psi/symbol? [1 2 3]) => (1 2 3) ((var-get #'plugin.psi/symbol?) 2) => (clojure.core/instance? org.jetbrains.plugins.clojure.psi.api.symbols.ClSymbol 2)
What that looks like to me is that the macro fn (i.e. the one that is usually in the :inline meta) is being stored in the var. So when it's used by filter, it always returns true. Does anyone have any idea what else I could try to debug this? I'll leave the REPL session open so I can try any suggestions. I just tried this, looks like the fns are not the same, at least, but they do have the same effect: (meta #'plugin.psi/symbol?) => {:inline plugin.psi$symbol_QMARK_@3781ff7f, :ns plugin.psi, :name symbol?, :arglists ([element]), :column 1, :line 35, :file "plugin/psi.clj"} (= plugin.psi/symbol? (:inline (meta #'plugin.psi/symbol?))) => false plugin.psi/symbol? => plugin.psi$symbol_QMARK_@4ccc75ae ((:inline (meta #'plugin.psi/symbol?)) 2) => (clojure.core/instance? org.jetbrains.plugins.clojure.psi.api.symbols.ClSymbol 2) On 20 June 2013 22:48, Colin Fleming <colin.mailingl...@gmail.com> wrote: > ClSymbol is a Java class. I don't get the replacement warning because I've > excluded that symbol explicitly in my ns declaration using :refer-clojure > :exclude. > > I haven't done a 'lein clean' because I'm not using lein, but I have > rebuilt various times. However, sometimes it will work and sometimes it > won't. I just tried this now, and I've been unable to reproduce. I guess > I'll keep working tomorrow and see if it crops up again. If I see it again > I'm going to try ((var-get #'symbol?) 2) to see if the results from the > function differ from the macroexpanded version. > > > > > On 20 June 2013 22:21, Jim - FooBar(); <jimpil1...@gmail.com> wrote: > >> 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 >> >> >> >> >> >> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com> >> For more options, visit this group at >> http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en> >> --- You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to >> clojure+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com> >> . >> For more options, visit >> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >> . >> >> >> > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.