Fork me on GitHub
#planck
<
2016-07-02
>
johanatan00:07:11

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

johanatan00:07:23

any idea why that is? if it is correct? and if not how to fix it? 🙂

johanatan00:07:47

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"

johanatan00:07:23

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.

mfikes00:07:09

@johanatan: planck.core/intern exists if it helps 🙂

johanatan00:07:36

yep, it does. 🙂

johanatan00:07:41

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

johanatan01:07:58

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

mfikes02:07:17

Wonder if (pst) gives a clue as to where that it coming from

johanatan04:07:30

Mm, I'll try that when I get a chance

johanatan04:07:01

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