Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by
I can use the symbol {{&}} to name something, but if I try to invoke it, the following exception is thrown:


Exception in thread "main" clojure.lang.ExceptionInfo: failed compiling file:src/amp/core.cljs {:file #object[java.io.File 0x5e63cad "src/amp/core.cljs"]}, compiling:(/home/madstap/code/ampersand/build.clj:3:1)
    at clojure.lang.Compiler.load(Compiler.java:7391)
    at clojure.lang.Compiler.loadFile(Compiler.java:7317)
    at clojure.main$load_script.invokeStatic(main.clj:275)
    at clojure.main$script_opt.invokeStatic(main.clj:335)
    at clojure.main$script_opt.invoke(main.clj:330)
    at clojure.main$main.invokeStatic(main.clj:421)
    at clojure.main$main.doInvoke(main.clj:384)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.lang.Var.invoke(Var.java:379)
    at clojure.lang.AFn.applyToHelper(AFn.java:154)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: clojure.lang.ExceptionInfo: failed compiling file:src/amp/core.cljs {:file #object[java.io.File 0x5e63cad "src/amp/core.cljs"]}
    at clojure.core$ex_info.invokeStatic(core.clj:4617)
    at cljs.compiler$compile_file$fn__3147.invoke(compiler.cljc:1406)
    at cljs.compiler$compile_file.invokeStatic(compiler.cljc:1376)
    at cljs.closure$compile_file.invokeStatic(closure.clj:430)
    at cljs.closure$fn__4204.invokeStatic(closure.clj:497)
    at cljs.closure$fn__4204.invoke(closure.clj:493)
    at cljs.closure$fn__4146$G__4139__4153.invoke(closure.clj:389)
    at cljs.closure$compile_sources$iter__4315__4319$fn__4320.invoke(closure.clj:829)
    at clojure.lang.LazySeq.sval(LazySeq.java:40)
    at clojure.lang.LazySeq.seq(LazySeq.java:49)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.next(RT.java:688)
    at clojure.core$next__4341.invokeStatic(core.clj:64)
    at clojure.core$dorun.invokeStatic(core.clj:3033)
    at clojure.core$doall.invokeStatic(core.clj:3039)
    at cljs.closure$compile_sources.invokeStatic(closure.clj:826)
    at cljs.closure$build.invokeStatic(closure.clj:1942)
    at cljs.build.api$build.invokeStatic(api.clj:198)
    at cljs.build.api$build.invoke(api.clj:187)
    at cljs.build.api$build.invokeStatic(api.clj:190)
    at cljs.build.api$build.invoke(api.clj:187)
    at user$eval24.invokeStatic(build.clj:3)
    at user$eval24.invoke(build.clj:3)
    at clojure.lang.Compiler.eval(Compiler.java:6927)
    at clojure.lang.Compiler.load(Compiler.java:7379)
    ... 11 more
Caused by: clojure.lang.ExceptionInfo: No method in multimethod 'parse' for dispatch value: & at line 5 src/amp/core.cljs {:file "src/amp/core.cljs", :line 5, :column 1, :tag :cljs/analysis-error}
    at clojure.core$ex_info.invokeStatic(core.clj:4617)
    at cljs.analyzer$error.invokeStatic(analyzer.cljc:628)
    at cljs.analyzer$analyze_seq_STAR__wrap.invokeStatic(analyzer.cljc:2871)
    at cljs.analyzer$analyze_seq.invokeStatic(analyzer.cljc:2892)
    at cljs.analyzer$analyze_form.invokeStatic(analyzer.cljc:3011)
    at cljs.analyzer$analyze_STAR_.invokeStatic(analyzer.cljc:3056)
    at cljs.analyzer$analyze.invokeStatic(analyzer.cljc:3073)
    at cljs.compiler$emit_source.invokeStatic(compiler.cljc:1255)
    at cljs.compiler$compile_file_STAR_$fn__3124.invoke(compiler.cljc:1325)
    at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1159)
    at cljs.compiler$compile_file_STAR_.invokeStatic(compiler.cljc:1316)
    at cljs.compiler$compile_file$fn__3147.invoke(compiler.cljc:1396)
    ... 34 more
Caused by: java.lang.IllegalArgumentException: No method in multimethod 'parse' for dispatch value: &
    at clojure.lang.MultiFn.getFn(MultiFn.java:156)
    at clojure.lang.MultiFn.invoke(MultiFn.java:251)
    at cljs.analyzer$analyze_seq_STAR_.invokeStatic(analyzer.cljc:2867)
    at cljs.analyzer$analyze_seq_STAR__wrap.invokeStatic(analyzer.cljc:2870)
    ... 43 more

3 Answers

0 votes
by

Comment made by: madstap

Better explanation as I can't seem to edit the description: https://gist.github.com/madstap/c77581185afa7fea8bbf2556f2d9fafe

0 votes
by
_Comment made by: mfikes_

If ClojureScript's symbols follow Clojure's constraints (https://clojure.org/reference/reader#_symbols), then {{&}} is not a valid symbol.

Of course, (type (second (second '(fn [f & r])))) is {{cljs.core/Symbol}}, but perhaps that is an exception to the rule, reserved for use by Clojure.
0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-1889 (reported by alex+import)
...