so i dug in a little deeper and it appears that a var as val nested in a ^{...}
meta block is added as the symbol itself and not what it resolves to. <-- @mfikes
any idea why that is? if it is correct? and if not how to fix it? 🙂
oooh, this seems to work:
cljs.user=> (def a nil)
#'cljs.user/a
cljs.user=> (def a (with-meta 'a {:doc doc-string}))
#'cljs.user/a
cljs.user=> (meta a)
{:doc "docstring"}
cljs.user=> doc-string
"docstring"
I think I could use the above fact with intern
to make this happen but alas intern
doesn't seem to be supported on CLJS.
@johanatan: planck.core/intern
exists if it helps 🙂
yep, it does. 🙂
cljs.user=> (def doc-string "docstring")
#'cljs.user/doc-string
cljs.user=> (planck.core/intern 'cljs.user (with-meta 'a {:doc doc-string}) nil)
#'cljs.user/a
cljs.user=> a
nil
cljs.user=> (doc a)
{:ns cljs.user, :name a, :doc docstring, :forms nil, :arglists nil}
-------------------------
cljs.user/a
docstring
nil
So, although the above works in the repl, when I put the following in shell.cljs, I get the following error on require:
(planck.core/intern 'planck.shell 'sh (fn [_] 9))
cljs.user=> (require '[planck.shell])
Could not require planck.shell
Assert failed: (ana/ast? sym)
nil
Wonder if (pst)
gives a clue as to where that it coming from
Mm, I'll try that when I get a chance
cljs.user=> (require '[planck.shell])
Could not require planck.shell
Assert failed: (ana/ast? sym)
nil
cljs.user=> (pst)
undefined is not an object (evaluating 'planck.shell.sh')
nil