bhauman / devcards

Devcards aims to provide a visual REPL experience for ClojureScript
1.53k stars 116 forks source link

defcard-rg without a name causes compilation error #150

Open green-coder opened 5 years ago

green-coder commented 5 years ago

Minimal code to reproduce:

(defn hello []
  [:div "hello"])

(defcard-rg
  [hello])

;; [Figwheel:SEVERE] java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Associative

I suspect that the problem is related to devcards.core/merge-options and macro expansion.

green-coder commented 5 years ago

I would like to propose to change the default value 'reagent-card used for the name, as it is likely that the user will use it by luck and run into unexpected behaviour - as I did.

'__reagent-card would be better.

Same remark for 'card -> '__card

green-coder commented 5 years ago

It appears that the compilation error is happening because of the assoc at https://github.com/bhauman/devcards/blob/master/src/devcards/core.clj#L154 which is applied onto unevaluated code from devcards.core/merge-options.