Fork me on GitHub
#clerk
<
2023-02-10
>
jjttjj15:02:57

Are there any known issues with declaring protocols in a file you want to show with clerk? With this code:

(ns clerk-debug)

(defprotocol Test
  (hello [this]))
In a fresh repl:
(require '[nextjournal.clerk :as clerk])
(clerk/serve! {:browse? true})
 (clerk/show! "src/clerk_debug.clj")
 
I'm getting the following error: I can open an issue if desired

mkvlr15:02:02

what version is this? Can you try if it reproduces with main?

mkvlr15:02:41

and maybe move the stacktrace to this thread if you don’t mind

jjttjj16:02:16

The version is: io.github.nextjournal/clerk {:mvn/version "0.12.707"}

jjttjj16:02:53

Oh awesome thanks!

mkvlr16:02:00

>> Also discovered cases where classes instead of symbols could end up in the dependency graph and introduced normalization to symbols.

mkvlr16:02:27

can you try a git dep on this project or is it using lein?

jjttjj16:02:15

Yup bumping the dep to the current git sha fixed it, thanks!

jjttjj16:02:22

Here's the stacktrace for future searchability:

#error {
 :cause "class java.lang.Class cannot be cast to class clojure.lang.Symbol (java.lang.Class is in module java.base of loader 'bootstrap'; clojure.lang.Symbol is in unnamed module of loader 'app')"
 :via
 [{:type java.lang.ClassCastException
   :message "class java.lang.Class cannot be cast to class clojure.lang.Symbol (java.lang.Class is in module java.base of loader 'bootstrap'; clojure.lang.Symbol is in unnamed module of loader 'app')"
   :at [clojure.core$ns_resolve invokeStatic "core.clj" 4370]}]
 :trace
 [[clojure.core$ns_resolve invokeStatic "core.clj" 4370]
  [clojure.core$ns_resolve invokeStatic "core.clj" 4360]
  [clojure.core$resolve invokeStatic "core.clj" 4373]
  [clojure.core$resolve invoke "core.clj" 4373]
  [nextjournal.clerk.analyzer$symbol__GT_jar invokeStatic "analyzer.clj" 360]
  [nextjournal.clerk.analyzer$symbol__GT_jar invoke "analyzer.clj" 359]
  [nextjournal.clerk.analyzer$find_location invokeStatic "analyzer.clj" 381]
  [nextjournal.clerk.analyzer$find_location invoke "analyzer.clj" 375]
  [clojure.core$group_by$fn__8597 invoke "core.clj" 7224]
  [clojure.core.protocols$iter_reduce invokeStatic "protocols.clj" 49]
  [clojure.core.protocols$fn__8230 invokeStatic "protocols.clj" 75]
  [clojure.core.protocols$fn__8230 invoke "protocols.clj" 75]
  [clojure.core.protocols$fn__8178$G__8173__8191 invoke "protocols.clj" 13]
  [clojure.core$reduce invokeStatic "core.clj" 6886]
  [clojure.core$group_by invokeStatic "core.clj" 7214]
  [clojure.core$group_by invoke "core.clj" 7214]
  [nextjournal.clerk.analyzer$build_graph invokeStatic "analyzer.clj" 411]
  [nextjournal.clerk.analyzer$build_graph invoke "analyzer.clj" 398]
  [nextjournal.clerk.eval$_PLUS_eval_results invokeStatic "eval.clj" 218]
  [nextjournal.clerk.eval$_PLUS_eval_results invoke "eval.clj" 215]
  [nextjournal.clerk$show_BANG_ invokeStatic "clerk.clj" 58]
  [nextjournal.clerk$show_BANG_ invoke "clerk.clj" 23]
  [user$eval24836 invokeStatic "NO_SOURCE_FILE" 1]
  [user$eval24836 invoke "NO_SOURCE_FILE" 1]
  [clojure.lang.Compiler eval "Compiler.java" 7194]
  [clojure.lang.Compiler eval "Compiler.java" 7149]
  [clojure.core$eval invokeStatic "core.clj" 3215]
  [clojure.core$eval invoke "core.clj" 3211]
  [clojure.main$repl$read_eval_print__9206$fn__9209 invoke "main.clj" 437]
  [clojure.main$repl$read_eval_print__9206 invoke "main.clj" 437]
  [clojure.main$repl$fn__9215 invoke "main.clj" 458]
  [clojure.main$repl invokeStatic "main.clj" 458]
  [clojure.main$repl_opt invokeStatic "main.clj" 522]
  [clojure.main$main invokeStatic "main.clj" 667]
  [clojure.main$main doInvoke "main.clj" 616]
  [clojure.lang.RestFn invoke "RestFn.java" 397]
  [clojure.lang.AFn applyToHelper "AFn.java" 152]
  [clojure.lang.RestFn applyTo "RestFn.java" 132]
  [clojure.lang.Var applyTo "Var.java" 705]
  [clojure.main main "main.java" 40]]}
  

mkvlr16:02:35

good to hear!

mkvlr16:02:23

if you’re using custom viewers on this project you might need to fully qualify render fns

mkvlr16:02:49

plan to make the migration easier before cutting a release

jjttjj16:02:53

Cool, thanks for the heads up