Probably a bug, please open a ticket in JIRA thanks!

On Mon, May 28, 2012 at 7:45 AM, r0man <roman.sche...@burningswell.com>wrote:

> Hello ClojureScripters,
>
> I'm trying to update a port of hiccup [1] to the latest
> ClojureScript version. During HTML compilation I call at some
> point eval (in a Clojure macro) on a datastructure and get a
> java.lang.ClassCastException. This used in ClojureScript versions
> before 0.0-1211.
>
> I traced it down to the following example. This works in
> ClojureScript 0.0-1011:
>
> ; Define a Clojure macro.
> (defmacro eval-test [arg]
>   (eval arg))
>
> ; Use the Clojure macro from ClojureScript.
> (eval-test "1")
> ;=> "1"
> (eval-test 1)
> ;=> 1
> (eval-test "div")
> ;=> "div"
> (eval-test :div)
> ;=> :div
> (eval-test [])
> ;=> []
> (eval-test {})
> ;=> {}
> (eval-test #{})
> ;=> #{}
>
> In ClojureScript 0.0-1211 it works on strings, numbers and
> symbols, but fails on vectors, maps and sets. I get the follwoing
> results:
>
> (eval-test "1")
> ;=> "1"
> (eval-test 1)
> ;=> 1
> (eval-test "div")
> ;=> "div"
> (eval-test :div)
> ;=> :div
> (eval-test [])
>
> java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to
> clojure.lang.Namespace, compiling:(NO_SOURCE_PATH:1)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462)
> at clojure.lang.Compiler.analyze(Compiler.java:6262)
> at clojure.lang.Compiler.eval(Compiler.java:6508)
> at clojure.lang.Compiler.eval(Compiler.java:6477)
> at clojure.core$eval.invoke(core.clj:2797)
> at hiccup.core$eval_test.invoke(core.clj:20)
> at clojure.lang.AFn.applyToHelper(AFn.java:167)
> at clojure.lang.AFn.applyTo(AFn.java:151)
> at clojure.core$apply.invoke(core.clj:605)
> at cljs.compiler$macroexpand_1.invoke(compiler.clj:1351)
> at cljs.compiler$analyze_seq.invoke(compiler.clj:1368)
> at cljs.compiler$analyze.invoke(compiler.clj:1425)
> at cljs.compiler$analyze.invoke(compiler.clj:1418)
> at cljs.repl$evaluate_form.invoke(repl.clj:64)
> at cljs.repl$eval_and_print.invoke(repl.clj:124)
> at cljs.repl$repl.doInvoke(repl.clj:173)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at cljsbuild.repl.listen$run_repl_listen.invoke(listen.clj:10)
> at cljsbuild.repl.listen$run_repl_launch.invoke(listen.clj:31)
> at user$eval2490.invoke(NO_SOURCE_FILE:1)
> at clojure.lang.Compiler.eval(Compiler.java:6511)
> at clojure.lang.Compiler.eval(Compiler.java:6500)
> at clojure.lang.Compiler.eval(Compiler.java:6501)
> at clojure.lang.Compiler.eval(Compiler.java:6477)
> at clojure.core$eval.invoke(core.clj:2797)
> at clojure.main$eval_opt.invoke(main.clj:297)
> at clojure.main$initialize.invoke(main.clj:316)
> at clojure.main$null_opt.invoke(main.clj:349)
> at clojure.main$main.doInvoke(main.clj:427)
> at clojure.lang.RestFn.invoke(RestFn.java:421)
> at clojure.lang.Var.invoke(Var.java:419)
> at clojure.lang.AFn.applyToHelper(AFn.java:163)
> at clojure.lang.Var.applyTo(Var.java:532)
> at clojure.main.main(main.java:37)
> Caused by: java.lang.ClassCastException: clojure.lang.Symbol cannot be
> cast to clojure.lang.Namespace
> at clojure.lang.Compiler.currentNS(Compiler.java:6864)
> at clojure.lang.Compiler.lookupVar(Compiler.java:6826)
> at clojure.lang.Compiler.lookupVar(Compiler.java:6847)
> at clojure.lang.Compiler.isInline(Compiler.java:6323)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6448)
> ... 33 more
> java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to
> clojure.lang.Namespace, compiling:(NO_SOURCE_PATH:1)
>
> Does anyone have an idea what has changed between those versions?
> Could this be a bug?
>
> Thanks for your help, Roman.
>
> [1] https://github.com/r0man/hiccup/tree/clojurescript
>
>  --
> 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 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

Reply via email to