sci 2022-03-10

@borkdude NPE for you…

Encountered error when macroexpanding sci.core/copy-ns.
NullPointerException: Cannot invoke "clojure.lang.IFn.invoke(Object)" because the return value of "clojure.lang.Var.getRawRoot()" is null
	sci.core/copy-ns (core.cljc:376)
	sci.core/copy-ns (core.cljc:336)
	clojure.core/apply (core.clj:671)
	clojure.core/apply (core.clj:662)

@borkdude I went to make a repro of this, and some combo of deleting out and friends got this error to go away

so now I am a happy user of copy-ns

Do you think I should replace anything in here https://github.com/sicmutils/sicmutils/blob/main/src/sicmutils/env/sci.cljc#L43-L128 with copy-ns? I don’t think it existed at that time

This happens with

(ns demo.viewers
  (:require [demo.mathbox]
            [nextjournal.clerk.sci-viewer :as sv]
            [sci.core :as sci]))

(sci/merge-opts
 @sv/!sci-ctx
 {:namespaces {'demo.mathbox
               (sci/copy-ns demo.mathbox (sci/create-ns 'demo.mathbox))}})

(defn cake [x]
  (* x x))
trying to narrow it down, then I’ll paste demo.mathbox

the target namespace is very simple:

(ns demo.face)
(defn square [x] (* x x))

Seems like cljs-ns-publics is null:

(def ^:private cljs-ns-publics
    (try (resolve 'cljs.analyzer.api/ns-publics)
         (catch #?(:clj Exception
                   :cljs :default) _ nil)))

Hi. I'm going to read this now.

Can you make a repro?

yes, will try and do it today

I didn't forget, just scrambling for these talk preps!

👍 ! I'm also preparing a talk!

But I'm procrastinating a lot on it...

Saw your tweet, that's why we're so productive

I got shanghai-Ed into giving THREE at this conference

lol, what conf is it?

<programming> in Portugal (keynote) and European Lisp Symposium, collocated, doing a keynote and “guts of sicmutils” talk

Your work will get a shoutout, multiple shoutouts