This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-26
Channels
- # announcements (9)
- # babashka (36)
- # beginners (13)
- # biff (24)
- # calva (12)
- # clj-kondo (18)
- # clojure (65)
- # clojure-brasil (1)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (87)
- # clojure-uk (4)
- # clojurescript (28)
- # datahike (25)
- # fulcro (12)
- # hyperfiddle (16)
- # malli (74)
- # missionary (1)
- # music (2)
- # off-topic (24)
- # polylith (4)
- # releases (3)
- # tools-deps (23)
I am trying to use a statechart library to manage state in my babashka script, but am having a problem bringing up the event loop:
Type: java.lang.Exception
Message: Unable to resolve classname: java.util.concurrent.CountDownLatch
Location: taoensso/encore.cljc:87:3
The short answer is yes. Every java class that gets included takes some space in the executable (for graalvm reasons). I think borkdude typically recommends something along the lines of "if there's a compelling use case, create an issue on the bb repo to see if it should be added, how much size it adds to the executable, etc"
I see it here in the list: https://github.com/babashka/babashka/blob/master/src/babashka/impl/classes.clj#L464
For reference here is the event loop from the statechart library: https://github.com/fulcrologic/statecharts/blob/main/src/main/com/fulcrologic/statecharts/event_queue/core_async_event_loop.cljc
based on https://clojurians.slack.com/archives/CLX41ASCS/p1710278088582459, it looks like it might be a recent addition... you could check if your bb is up to date, or it might be that a new version just hasn't been released since that change was made - you could maybe try with a master build (if you wanna get a little experimental)
the commit that added the class in question looks like it's from 3/13, and the latest release on github is from the end of February
Yeah, it'll be in the next version I guess, just tried to brew upgrade but my bb is already newest. Thanks.
if you want to give it a shot (to see if there are any other classes that might be needed or whatever), #CSDUA8S6B has links to CI builds for some of the linux and macos architectures
Mmmm the links in there for the linux static binary do not download anything, just a server not found page. I guess I'll have to wait till the next release. Thanks for the pointer though I would not have liked to scrap the whole idea for my app state.
Interesting... maybe those links go stale since they're a few days old now. Depending on how bad you want it, you could probably go to circleci using the badge in the github readme and find a build and maybe get an artifact from there (if you want to do a little exploring)
Thanks @U04V15CAJ that let me get the latest build of bb installed. Unfortunately the statecharts library still doesn't work. It works great in clojure, but in bb it gets weird errors on missing symbol:
clojure.lang.ExceptionInfo: Could not resolve symbol: taoensso.encore/catching
I have the dependency for that in bb.edn though:
com.taoensso/encore {:mvn/version "3.98.0-RC7"}
taoensso.encore isn't a great library to run in bb since it contains all kinds of unidiomatic hacks :)
Yeah I am seeing that in the source now that I Iook, the statecharts library is damn good but he uses encore from many of his libraries.
It is a series of state machines, it lets me handle the entire flow of my app and the state in a very systematic way.
Basically it's an iteration on statemachines that gives more flexibility and a "pretty" way to define them.
I have it all working on clojure and was hoping to move it to bb for the startup speed since it's a cli app. It was I think very close to working, but for the decision to use timbre and encore for that statecharts lib.
it only uses taoensso.encore/catching
so if you pre-define that, it should maybe work:
https://github.com/fulcrologic/statecharts/blob/0da2b602d0d1634ac27a238149dac46433d9809b/src/main/com/fulcrologic/statecharts/event_queue/core_async_event_loop.cljc#L35
I would love to move to bb for this to distribute for more operating systems and also that startup speed boost.
perhaps make a fork of this statecharts library and try to get rid of this catching macro
or put a file on your classpath like so:
taoensso/encore.cljc
with the macros inside----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: Could not resolve symbol: taoensso.encore/catching
Data: {:type :sci/error, :line 178, :column 1, :file "com/fulcrologic/statecharts/chart.cljc", :phase "analysis"}
Location: com/fulcrologic/statecharts/chart.cljc:184:3
Phase: analysis