This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-30
Channels
- # aleph (2)
- # announcements (4)
- # babashka (3)
- # beginners (89)
- # calva (12)
- # cljdoc (7)
- # cljsrn (5)
- # clojars (1)
- # clojure (19)
- # clojure-dev (6)
- # clojure-europe (2)
- # clojurescript (12)
- # conjure (7)
- # cursive (4)
- # fulcro (28)
- # graphql (6)
- # gratitude (2)
- # introduce-yourself (2)
- # jobs (1)
- # jobs-discuss (26)
- # off-topic (2)
- # pathom (22)
- # pedestal (2)
- # podcasts (10)
- # re-frame (9)
- # reitit (8)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (1)
- # tools-deps (27)
- # xtdb (11)
I’d like to be able to print out the docstring for a macro that used in CLJS. The macro is defined in a CLJ file then required in a CLJS file via require-macros
. I’m working towards documenting some of our work standards and having the docstring available to present would be super helpful.
In CLJ, I would normally use (:doc (meta #'macro-here))
, but that doesn’t seem to work the same when requiring macros.
Is there a different way I should be solving this?
there might be a better way, but you can pull it out in another macro since that runs in the CLJ scope
@U3JH98J4R Are you suggesting writing a CLJ macro? That might be useful in a number of places for us anyway
@U3JH98J4R Thanks. I am struggling with the details here.
I wrote the macro like this and used refer-macros
, but I’m getting the error that it can’t resolve the passed in var
(defmacro docstring [fn]
`(:doc (meta (var ~fn))))
(docstring defn)
Unable to resolve var: defn in this context
This whole process needs to run in CLJ, and the thing that gets inserted into CLJS as code would just be the literal string