This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-10
Channels
- # announcements (3)
- # asami (19)
- # babashka (38)
- # beginners (42)
- # cider (19)
- # clojure (17)
- # clojure-europe (34)
- # clojure-hungary (3)
- # clojure-nl (1)
- # clojure-norway (53)
- # clojure-uk (7)
- # clojuredesign-podcast (34)
- # conjure (2)
- # cursive (7)
- # data-science (13)
- # datalevin (3)
- # datomic (19)
- # dev-tooling (1)
- # events (1)
- # honeysql (2)
- # hyperfiddle (31)
- # integrant (16)
- # juxt (39)
- # missionary (14)
- # nrepl (14)
- # off-topic (57)
- # overtone (22)
- # podcasts-discuss (1)
- # practicalli (32)
- # reitit (12)
- # releases (2)
- # ring (13)
- # ring-swagger (2)
- # sql (85)
- # squint (75)
https://github.com/dotnet/roslyn 18k, Though I see aspnetcore has 33k
maybe this is a question better suited for #C015LCR9MHD?
maybe https://book.babashka.org/#differences-with-clojure should be updated to make mention of the differences? is there documentation about the differences?
it just says "no deftype
", sorry
maybe i'm misusing it in my app
yes, as I said, the docs could be stale. deftype exists because of compatibility with existing libraries but it's better to just avoid it when you can
Babashka v1.3.186-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (deftype Foo [])
user.Foo
user=> (->Foo)
#object[user.Foo 0x4065989e "user.Foo@4065989e"]
okay, i must be messing something up. thanks
if you have a repro, I would be able to explain why it would work in bb or not. if you're trying to implement clj interfaces on deftype, you're in bad luck
well, it turns out whatever i'm doing also doesn't work in clojure (tho it's working in the repl), so i'm not sure what i'm doing wrong
re the binary cat
which bb` my-uberjar.jar` trick (which is reportedly the same as bb --jar my-uberjar.jar
)
I tried this with the uberjar I've been using with graalvm to make my ys
command, and I get:
$ bb --jar target/uberjar/yamlscript.cli-0.1.0-SNAPSHOT-standalone.jar
----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: Could not resolve symbol: pprint/write-option-table
Data: {:type :sci/error, :line 12, :column 1, :file "a0/patch_pprint.clj", :phase "analysis"}
Location: a0/patch_pprint.clj:13:19
Phase: analysis
----- Context ------------------------------------------------------------------
9:
10: (defonce patched? (volatile! false))
11:
12: (when-not @patched?
13: (alter-var-root #'pprint/write-option-table
^--- Could not resolve symbol: pprint/write-option-table
14: (fn [m]
15: (zipmap (keys m)
16: (map find-var (vals m))))))
17:
18: (def new-table-ize
----- Stack trace --------------------------------------------------------------
a0.patch-pprint - a0/patch_pprint.clj:13:19
clojure.core/alter-var-root -
a0.patch-pprint/when-not - a0/patch_pprint.clj:13:3
a0.patch-pprint - a0/patch_pprint.clj:12:1
clojure.core/when-not -
a0.patch-pprint - a0/patch_pprint.clj:12:1
a0.patch-pprint - a0/patch_pprint.clj:12:1
yamlscript.core - yamlscript/core.clj:13:3
yamlscript.cli - yamlscript/cli.clj:9:3
user - :1:10
the a0/patch_pprint.clj
thing is a trick that @borkdude helped me craft to massively reduce the size of my final binary file (`ys`)@U05H8N9V0HZ you are trying to run your entire project through SCI this way. the pprint/write-option-table
var isn't exposed in bb (SCI) since it's a private var
you could just remove that bit when you're in bb, which is done as follows:
(defmacro if-bb [then else]
(if (System/getProperty "babashka.version")
then else))
(if-bb nil ....)ok, I was just following the https://github.com/babashka/babashka/wiki/Self-contained-executable#uberjar instructions to put bb in front of an uberjar with a -main
I'll try that, thanks. I guess this is a rather odd case for an uberjar
your mental model should be that the code in the jar file is a babashka-compatible project
I see
You might want to clarify that in https://github.com/babashka/babashka/wiki/Self-contained-executable#uberjar
it is already clarified:
This is effectively the same as running ./bb --jar uber.jar but all within one self-contained-binary.
From my pov, I went to this page because I heard you could turn an uberjar into a binary executable. I had an uberjar and followed the instructions and it failed.
maybe "Given an uberjar uber.jar
that works with bb, ..."
Also there is a reference to https://book.babashka.org/#_uberjar which shows how to build uberjars from your _bb_ program
I get what you are saying, but you are assuming my mental model
done. thanks