Fork me on GitHub
#sci
<
2022-03-10
>
Sam Ritchie18:03:04

@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)

Sam Ritchie18:03:31

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

Sam Ritchie18:03:18

the target namespace is very simple:

Sam Ritchie18:03:22

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

Sam Ritchie18:03:37

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)))

borkdude19:03:44

Hi. I'm going to read this now.

borkdude19:03:13

Can you make a repro?

Sam Ritchie19:03:17

yes, will try and do it today

Sam Ritchie15:03:28

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

borkdude15:03:16

:thumbsup: ! I'm also preparing a talk!

borkdude15:03:25

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

Sam Ritchie15:03:29

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

Sam Ritchie15:03:47

I got shanghai-Ed into giving THREE at this conference

borkdude15:03:59

lol, what conf is it?

Sam Ritchie15:03:02

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

Sam Ritchie15:03:11

Your work will get a shoutout, multiple shoutouts

Sam Ritchie08:03:34

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

Sam Ritchie08:03:40

so now I am a happy user of copy-ns

Sam Ritchie08:03:18

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