This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-11
Channels
- # asami (19)
- # babashka (41)
- # beginners (115)
- # biff (7)
- # calva (78)
- # clj-kondo (29)
- # cljs-dev (9)
- # clojure (39)
- # clojure-europe (17)
- # clojure-gamedev (29)
- # clojure-nl (1)
- # clojure-norway (9)
- # clojure-spec (2)
- # clojure-uk (3)
- # clojurescript (7)
- # core-async (26)
- # cursive (16)
- # datomic (13)
- # emacs (1)
- # events (5)
- # fulcro (2)
- # funcool (4)
- # gratitude (1)
- # helix (1)
- # holy-lambda (1)
- # humbleui (1)
- # introduce-yourself (4)
- # java (1)
- # jobs (2)
- # jobs-discuss (9)
- # lsp (28)
- # matcher-combinators (2)
- # mathematics (1)
- # membrane (1)
- # nbb (12)
- # off-topic (10)
- # pathom (52)
- # polylith (38)
- # portal (32)
- # re-frame (4)
- # reagent (16)
- # reitit (2)
- # remote-jobs (1)
- # reveal (1)
- # rewrite-clj (10)
- # sci (67)
- # shadow-cljs (45)
- # squint (1)
- # tools-build (13)
- # tools-deps (16)
@borkdude I made this tiny branch to fix some type hint warnings. Not sure if you would go with ^clj
or ^js
or js/Promise
there, I figured ^clj
since it should be ok for these to be renamed https://github.com/babashka/sci/compare/master...mhuebert:sci:sci-await-type-hints?expand=1
has anyone seen this before?
[:clerk] Build failure:
------ ERROR -------------------------------------------------------------------
File: jar:file:/Users/sritchie/.m2/repository/org/babashka/sci/0.4.33/sci-0.4.33.jar!/sci/impl/namespaces.cljc:1477:20
--------------------------------------------------------------------------------
1474 | 'unchecked-subtract (copy-core-var unchecked-subtract)
1475 | 'unchecked-negate-int (copy-core-var unchecked-negate-int)
1476 | 'unchecked-inc (copy-core-var unchecked-inc)
1477 | 'unchecked-char (copy-core-var unchecked-char)
--------------------------^-----------------------------------------------------
Encountered error when macroexpanding sci.impl.namespaces/copy-var.
NullPointerException: Cannot invoke "clojure.lang.IFn.invoke(Object, Object)" because the return value of "clojure.lang.Var.getRawRoot()" is null
sci.impl.namespaces/copy-var (namespaces.cljc:91)
sci.impl.namespaces/copy-var (namespaces.cljc:73)
clojure.core/apply (core.clj:671)
clojure.core/apply (core.clj:662)
I am getting this when I try and upgrade clerk, and sci => 0.4.33 from 0.3.5.@borkdude I can push a repro of course. very odd since this is the 4th project I’m upgrading… obviously I’ll need to find the difference here
org.clojure/clojurescript {:mvn/version "1.11.4"}
I’m making sure it’s getting picked up…
thheller/shadow-cljs {:mvn/version "2.17.4"}
same as on the other projects where it works
i’m killing all caches
ah, killing .cpcache got me to a new error
maybe… trying again
nope, same problem. let me try and shrink down the project
------ ERROR -------------------------------------------------------------------
File: /Users/sritchie/code/clj/repro/src/demo/viewers.cljs:33:10
--------------------------------------------------------------------------------
30 | #_#_'demo.mathbox (sci/copy-ns demo.mathbox (sci/create-ns 'demo.mathbox))
31 |
32 | 'demo.jsxgraph
33 | (sci/copy-ns demo.jsxgraph (sci/create-ns 'demo.jsxgraph))
----------------^---------------------------------------------------------------
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:409)
sci.core/copy-ns (core.cljc:362)
clojure.core/apply (core.clj:671)
the error tightened up when i re-checked out the project. compilation is fine until i use copy-ns
on any namespace
(working on a repro, feeding a baby too, sorry for livestream)
it’s a flaky bug, doesn’t happen every time, trying to pin it down
@borkdude okay I slimmed the repro WAY down: https://github.com/sritchie/sci-repro
no clerk, sicmutils etc, this is basically just SCI.
It seems that if I require either sci.core
or anything that transitively requires sci.core
in my user
namespace, then I get this big error later calling copy-ns
in cljs code.
thanks @borkdude, no rush!
FAIR, but still I can work around this now that I know what’s causing it
you are the most productive dude of all time, of course I’m just making it clear that I’m not trying to toss more on your extremely full plate!
@borkdude interesting, doesn’t happen with 0.3.5
only with 0.4.33 and 0.5.34
@U017QJZ9M7W You can work around this with:
(ns user
(:require [cljs.analyzer.api]
[sci.core]))
The issue is that when you load sci.core without loading CLJS cljs.analyzer.api resolves to nil. But then later you are loading SCI again, but as a ClojureScript dependency and the logic that needs the cljs analyzer doesn't have the right var
is there some way to use something like requiring-resolve here if it’s nil?
what I was doing in user.clj is rebinding some dynamic variables that I use for rendering options, so that when my cljs loads and creates my SCI namespaces I have the proper values set inside of Clerk
it’s odd, presumably cljs is on the classpath at this point. but I am probably misunderstanding the load order
So the issue is in cljs.cljc
:
(macros/deftime
#?(:clj (do (def cljs-ns-publics (resolve 'cljs.analyzer.api/ns-publics))
(prn :yes cljs-ns-publics)))
#_:clj-kondo/ignore
(defmacro ^:private require-cljs-analyzer-api []
(macros/? :clj
;; noop, macro executed from JVM Clojure, not within CLJS compiler
nil
:cljs #?(;; macro executed from JVM Clojure, within CLJS compiler
:clj
(do (require '[cljs.analyzer.api])
(def cljs-ns-publics (resolve 'cljs.analyzer.api/ns-publics)))
;; self-hosted CLJS, no require supported but also not necessary
:cljs nil))))
The first time you load this, then cljs-ns-publics
becomes nil if you have not yet loaded clojurescript
it doesn't require clojurescript since that's an optional dependency. I guess I could use requiring-resolve
there (but this requires clojure 1.10) but the downside there is that maybe you do have CLJS on the classpath, but you're not really using it, so then it loads it for nothing
I would argue that the fix for the user there is easy, to exclude cljs
But yeah I hear you
Side effects making life complicated, as usual!
ok, please try https://github.com/babashka/sci/commit/ffb486bda57db0b74cdd17f58b4867e46a22345e
Excellent trying in 10-15m
amazing, thank you @borkdude
@borkdude thank you, already on a git sha for sci so I’ll just bump it, no need for a release
@borkdude there might be an issue, seeing this now:
Encountered error when macroexpanding sci.core/copy-ns.
IllegalStateException: Attempting to call unbound fn: #'sci.impl.cljs/cljs-ns-publics
clojure.lang.Var$Unbound.throwArity (Var.java:45)
sci.core/copy-ns (core.cljc:411)
yup, will do, going to pin it down now
yikes, deleting .shadow-cljs
fixes it
I’m going to keep digging, it is back again
@U017QJZ9M7W I reverted the fix I did to solve the problem since it caused more issues than it solved. Here is a workaround for the user.clj situation https://github.com/babashka/sci#shadow-cljs--userclj