This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-11
Channels
- # announcements (1)
- # aws (5)
- # beginners (35)
- # calva (18)
- # clerk (5)
- # clojure (20)
- # clojure-berlin (1)
- # clojure-dev (12)
- # clojure-europe (16)
- # clojure-nl (1)
- # clojure-norway (159)
- # clojure-uk (5)
- # clojurescript (8)
- # conjure (1)
- # cursive (18)
- # events (10)
- # fulcro (23)
- # hyperfiddle (5)
- # introduce-yourself (3)
- # juxt (2)
- # off-topic (1)
- # polylith (4)
- # portal (11)
- # releases (1)
- # shadow-cljs (4)
- # xtdb (9)
- # yamlscript (1)
Portal fails when updated from 0.51.1 to 0.52.2 and run with babashka.
Type: clojure.lang.ExceptionInfo
Message: Could not resolve symbol: definterface
Data: {:type :sci/error, :line 22, :column 1, :file "clojure/data/json.clj", :phase "analysis"}
Location: clojure/data/json.clj:22:1
Phase: analysis
----- Context ------------------------------------------------------------------
18: ;; CUSTOM PUSHBACK READER
19:
20: (set! *warn-on-reflection* true)
21:
22: (definterface InternalPBR
^--- Could not resolve symbol: definterface
23: (^int readChar [])
24: (^long readChars [^chars buffer ^long start ^long bufflen])
25: (^void unreadChar [^int c])
26: (^void unreadChars [^chars buffer ^int off ^int bufflen])
27: (^java.io.Reader toReader []))
It is exactly the same error that antq library fixed in https://github.com/liquidz/antq/blob/main/CHANGELOG.adoc#281185-2024-02-23clojure.data.json no longer works with babashka, the newest version broke compatibility
a solution would be to use https://github.com/babashka/json which dispatches to whatever json library you uses and does the optimal thing for bb
In Portal clojure.data.json
is only referenced https://github.com/djblue/portal/blob/master/src/portal/runtime/json.cljc#L4. Which is under the more specific require for :bb which is cheshire.core
. I do think I bumped the version of org.clojure/data.json
from 2.4.0 to 2.5.0 when I upgraded all the dependencies in Portal, but I don't mind reverting it back if it's causing issues transitively.
Well, it is a sign that clojure.data.json is at least loaded in portal, you could make that :bb nil as well since loading dependencies that aren't really used only takes time
(ns ^:no-doc portal.runtime.json
(:refer-clojure :exclude [read])
#?(:bb (:require [cheshire.core :as json])
:clj (:require [clojure.data.json :as json])
:cljr (:require [portal.runtime.clr.assembly]
[clojure.data.json :as json])))
Since :bb comes before :clj and reader conditionals are mutually exclusive, Portal shouldn't be loading clojure.data.json
at all :thinking_face:I think the issues here is that Portal will break user code by forcing a later version of clojure.data.json
transitively.
ok you think it was just @U0281QDFE1X himself who loaded clojure.data.json -- right, that makes sense
Fixed this with https://github.com/djblue/portal/commit/92c025852bd01016ac62a684bbf71f709592d92d which should now be released in 0.53.0 👌