{"action":"created","issue":{"url":"https://api.github.com/repos/jgpc42/jmh-clojure/issues/3","repository_url":"https://api.github.com/repos/jgpc42/jmh-clojure","labels_url":"https://api.github.com/repos/jgpc42/jmh-clojure/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/jgpc42/jmh-clojure/issues/3/comments","events_url":"https://api.github.com/repos/jgpc42/jmh-clojure/issues/3/events","html_url":"https://github.com/jgpc42/jmh-clojure/issues/3","id":263746484,"number":3,"title":"Examples in README fail due to clojure.lang.Named cast exception","user":{"login":"lbradstreet","id":252189,"avatar_url":"https://avatars0.githubusercontent.com/u/252189?v=4","gravatar_id":"","url":"https://api.github.com/users/lbradstreet","html_url":"https://github.com/lbradstreet","followers_url":"https://api.github.com/users/lbradstreet/followers","following_url":"https://api.github.com/users/lbradstreet/following{/other_user}","gists_url":"https://api.github.com/users/lbradstreet/gists{/gist_id}","starred_url":"https://api.github.com/users/lbradstreet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbradstreet/subscriptions","organizations_url":"https://api.github.com/users/lbradstreet/orgs","repos_url":"https://api.github.com/users/lbradstreet/repos","events_url":"https://api.github.com/users/lbradstreet/events{/privacy}","received_events_url":"https://api.github.com/users/lbradstreet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-08T19:51:34Z","updated_at":"2017-10-08T21:52:30Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI've been waiting for this plugin/library for a long long time!\r\n\r\nI hit some issues running the README example, which I managed to fix by passing in symbols for the env rather than fns.\r\n\r\n```\r\n{:benchmarks\r\n [{:name :str, :fn demo.core/value-at, :args [:state/string, :state/index]}\r\n  {:name :vec, :fn demo.core/value-at, :args [:state/vector, :state/index]}]\r\n\r\n :states\r\n {:index {:fn (partial * 0.5), :args [:param/count]}\r\n  :string {:fn demo.utils/make-str, :args [:param/count]}\r\n  :vector {:fn demo.utils/make-vec, :args [:param/count]}}\r\n\r\n :params {:count 10}}\r\n```\r\n\r\n\r\n```\r\nUncaught exception, not in assertion.                                 \r\nexpected: nil                                                         \r\n  actual: java.lang.ClassCastException: clojure.core$partial$fn__5380 cannot be cast to clojure.lang.Named\r\n at clojure.core$namespace.invokeStatic (core.clj:1594)                                                                                     \r\n    clojure.core$namespace.invoke (core.clj:1594)                     \r\n    jmh.state$fn_load.invokeStatic (state.clj:147)                    \r\n    jmh.state$fn_load.invoke (state.clj:139)                          \r\n    clojure.core$map$fn__5406.invoke (core.clj:2733)                  \r\n    clojure.lang.LazySeq.sval (LazySeq.java:40)                       \r\n    clojure.lang.LazySeq.seq (LazySeq.java:49)                        \r\n    clojure.lang.RT.seq (RT.java:525)                                                                                                       \r\n    clojure.core$seq__4944.invokeStatic (core.clj:137)                                                                                      \r\n    clojure.core$apply.invokeStatic (core.clj:652)                                                                                          \r\n    clojure.core$mapcat.invokeStatic (core.clj:2763)                                                                                        \r\n    clojure.core$mapcat.doInvoke (core.clj:2763)                      \r\n    clojure.lang.RestFn.invoke (RestFn.java:423)                                                                                            \r\n    jmh.state$class_type.invokeStatic (state.clj:263)                                                                                       \r\n    jmh.state$class_type.invoke (state.clj:259)                       \r\n    clojure.core$map$fn__5406.invoke (core.clj:2735)\r\n    clojure.lang.LazySeq.sval (LazySeq.java:40)                       \r\n    clojure.lang.LazySeq.seq (LazySeq.java:56)                        \r\n    clojure.lang.ChunkedCons.chunkedNext (ChunkedCons.java:59)        \r\n    clojure.lang.ChunkedCons.next (ChunkedCons.java:43)                                                                                     \r\n    clojure.lang.PersistentVector.create (PersistentVector.java:73)   \r\n    clojure.lang.LazilyPersistentVector.create (LazilyPersistentVector.java:44)\r\n```"},"comment":{"url":"https://api.github.com/repos/jgpc42/jmh-clojure/issues/comments/335041370","html_url":"https://github.com/jgpc42/jmh-clojure/issues/3#issuecomment-335041370","issue_url":"https://api.github.com/repos/jgpc42/jmh-clojure/issues/3","id":335041370,"user":{"login":"jgpc42","id":16848225,"avatar_url":"https://avatars3.githubusercontent.com/u/16848225?v=4","gravatar_id":"","url":"https://api.github.com/users/jgpc42","html_url":"https://github.com/jgpc42","followers_url":"https://api.github.com/users/jgpc42/followers","following_url":"https://api.github.com/users/jgpc42/following{/other_user}","gists_url":"https://api.github.com/users/jgpc42/gists{/gist_id}","starred_url":"https://api.github.com/users/jgpc42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgpc42/subscriptions","organizations_url":"https://api.github.com/users/jgpc42/orgs","repos_url":"https://api.github.com/users/jgpc42/repos","events_url":"https://api.github.com/users/jgpc42/events{/privacy}","received_events_url":"https://api.github.com/users/jgpc42/received_events","type":"User","site_admin":false},"created_at":"2017-10-08T21:52:30Z","updated_at":"2017-10-08T21:52:30Z","author_association":"OWNER","body":"Hello there. Thank you for the interest! \r\n\r\nThe problem here, as you correctly stated, is that `jmh.core/run` expects data, not fns. This is due to how the generated classes must be compiled to be used with JMH.\r\n\r\nIn the example code from the README, the data in question is read from the `benchmarks.edn` file via `clojure.edn/read-string`, which returns simple data. In the case of the `:fn` values, namespaced symbols and a list of two symbols and a number: `(partial * 0.5)`. The symbols are later resolved, and the expression data is later `eval`uated in a JMH subprocess before running the benchmarks. \r\n\r\nI wrote a short article [here](https://github.com/jgpc42/jmh-clojure/wiki/How-It-Works) that describes a simplified model of this process if you're curious.\r\n\r\nThank you for opening this issue, however. I don't think I made this as clear as I should have. The exception should also be more descriptive of the actual problem. I have updated the README and added stricter checking of the `:fn` values. \r\n\r\nDoes the above sufficiently address this issue in your opinion? Also, please feel free to ask if you have any questions. Thanks again!"}}
{"actor":{"display_login":"jgpc42"}}