sci

Sam Ritchie 2022-03-10T18:19:04.238699Z

@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 Ritchie 2022-03-22T08:23:34.644269Z

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

Sam Ritchie 2022-03-22T08:23:40.764649Z

so now I am a happy user of copy-ns

Sam Ritchie 2022-03-22T08:24:18.550699Z

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

Sam Ritchie 2022-03-10T18:19:31.825329Z

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 Ritchie 2022-03-10T18:21:32.197209Z

@borkdude full error: https://gist.github.com/sritchie/2f011044417284716681eb6afb1f090b

Sam Ritchie 2022-03-10T18:23:18.106749Z

the target namespace is very simple:

Sam Ritchie 2022-03-10T18:23:22.144779Z

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

Sam Ritchie 2022-03-10T18:29:37.995039Z

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

borkdude 2022-03-10T19:10:44.895619Z

Hi. I'm going to read this now.

borkdude 2022-03-10T19:13:13.472489Z

Can you make a repro?

Sam Ritchie 2022-03-10T19:21:17.422339Z

yes, will try and do it today

borkdude 2022-03-11T15:30:50.063739Z

thanks :)

Sam Ritchie 2022-03-11T15:35:28.505569Z

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

borkdude 2022-03-11T15:39:16.109669Z

👍 ! I'm also preparing a talk!

borkdude 2022-03-11T15:39:25.539249Z

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

Sam Ritchie 2022-03-11T15:39:29.842029Z

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

borkdude 2022-03-11T15:39:38.321499Z

hehehe

Sam Ritchie 2022-03-11T15:39:47.687659Z

I got shanghai-Ed into giving THREE at this conference

borkdude 2022-03-11T15:39:59.484699Z

lol, what conf is it?

Sam Ritchie 2022-03-11T15:42:02.234859Z

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

Sam Ritchie 2022-03-11T15:42:11.510049Z

Your work will get a shoutout, multiple shoutouts

borkdude 2022-03-11T15:42:24.381699Z

nice!