planck

Planck ClojureScript REPL
johanatan 2016-07-02T00:07:11.000698Z

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

johanatan 2016-07-02T00:07:23.000699Z

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

johanatan 2016-07-02T00:09:47.000700Z

oooh, this seems to work:

cljs.user=&gt; (def a nil)
#'cljs.user/a
cljs.user=&gt; (def a (with-meta 'a {:doc doc-string}))
#'cljs.user/a
cljs.user=&gt; (meta a)
{:doc "docstring"}
cljs.user=&gt; doc-string
"docstring"

johanatan 2016-07-02T00:21:23.000702Z

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.

mfikes 2016-07-02T00:34:09.000703Z

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

johanatan 2016-07-02T00:36:36.000704Z

yep, it does. 🙂

johanatan 2016-07-02T00:36:41.000705Z

cljs.user=&gt; (def doc-string "docstring")
#'cljs.user/doc-string
cljs.user=&gt; (planck.core/intern 'cljs.user (with-meta 'a {:doc doc-string}) nil)
#'cljs.user/a
cljs.user=&gt; a
nil
cljs.user=&gt; (doc a)
{:ns cljs.user, :name a, :doc docstring, :forms nil, :arglists nil}
-------------------------
cljs.user/a
  docstring
nil

johanatan 2016-07-02T01:57:58.000706Z

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=&gt; (require '[planck.shell])
Could not require planck.shell
Assert failed: (ana/ast? sym)
nil

mfikes 2016-07-02T02:01:17.000707Z

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

johanatan 2016-07-02T04:05:30.000708Z

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

johanatan 2016-07-02T04:38:01.000709Z

cljs.user=&gt; (require '[planck.shell])
Could not require planck.shell
Assert failed: (ana/ast? sym)
nil
cljs.user=&gt; (pst)
undefined is not an object (evaluating 'planck.shell.sh')

nil