I managed to make a shim on top of Janet which boostraps sci https://github.com/yogthos/jolt
I still need to port immutable data structures, but the fact that it manages to compile all of sci and run it is pretty cool
does it also pass all of the tests? ;)
perhaps SCI could even support janet, but I don't know how much of a stretch that is. I don't know janet very well and don't know if it's close enough to clojure to do it with reader conditionals
yeah looks like the tests pass
I also wanted to support ClojureDart, to build a phone app where you could evaluate some CLJD in a phone app, sound like fun
it's still very raw though, so bugs are definitely there 🙂
thinking about this too, might actually be useful to have immutable data structures as a compile time toggle
oh and I just kind of assumed ClojureDart was already using sci
why did you think?
since sci is already fairly self contained it seems like an obvious choice if you're porting Clojure to a new runtime no?
there is edamame layer which I did have to shim, but that was pretty small
well SCI is an interpreter, ClojureDart isn't an interpreter but a compiler
that's true, I guess just taking cljs directly makes more sense there
cljs?
wouldn't you want to reuse most of the implementation?
does ClojureDart just do everything from scratch?
I don't know
Pretty cool! Is it possible to call a Janet function from Clojure code?
(Also, there is a #C015LCR9MHD channel too.)
without looking at the code, this should work since it's explicitly tested in SCI
oh yeah I missed the sci channel, and yeah calling Janet code should work, I'll add explicit interop there
What's your use case? 🤔
I'm using Janet as the plugin system here https://github.com/dirge-code/dirge so I was thinking I could get full blown Clojure here relatively easily
Janet is nice, but it's just different enough to trip me up 🙂
maybe jank would also work? not sure if C++ and Rust stuff mixes well, but .. probably?
I did look at it, but the runtime would be pretty chunky compared to Janet, and the build pipeline would also be more complex
Jank is great, but Janet is a lot more compact and easier to embed, also has a Rust wrapper already as well
there's a bunch of go clojure dialects now too. maybe also easy to embed. I just saw a post in #C8NUSGWG6 where the author embeds let-go on a remarkable 2 android device
yeah I've been following that a bit, let-go definitely seems neat, and honestly I regret going with Rust over go for my tool, compilation times get absolutely brutal once you get to 100k loc or so
it takes minutes on my machine, so any time I want to do something like a UI change where I need to test and see how it feels, it's a few minutes of waiting for the build
but jolt is mostly just to play around to be honest, Janet works well already
100k lines ... that's how much Clojure we had with a team of 4 devs of 5 years of writing :)
yeah you can produce a ridiculous amount of code once you have LLMs in the loop 🙂
to be fair Clojure is a lot more compact than Rust
but it's still a chunk of code to be sure
Does babashka have an environment variable like JAVA_TOOL_OPTIONS, where you could list args you want to pass to each invocation of bb?
I'm guessing no because there is no mention of it on http://book.babashka.org but I thought I'd ask
no, but there is BABASHKA_PRELUDE which is a code snippets that is invoked on each bb invocation, would that help?
I don't think so, I want to pass - 😛
does setting the system property work?
in BABASHKA_PRELUDE
I suppose I could set the property in code yeah
let me try
that particular bit of command line handling is done by graal, babashka can't even access it.
I'm wondering if there is a GRAAL env var then...
you can see all the available options by following the bb command line
thank you
Substrate VM opts:
-D<property>=<value> Set a system property (e.g. -Dx.y=99).
-Xmx<size>[g|G|m|M|k|K] Set a maximum heap size (e.g. -Xmx256M to limit the heap to 256MB).
-XX:PrintFlags= Print all Substrate VM options.I guess you could make a bb wrapper bash script on your system
which does exec bb -D... &?args
(pseudo-bash)
yeah, that could also work
looks like BABASHKA_PRELOADS isn't processed early enough for my usecase Exception in thread "main" java.lang.Exception: Error: Cannot download Clojure tools. Please download manually...
I'll go with the wrapper 🙂
wait, this is deps.clj
that should be affect by CLJ_JVM_OPTS
try that
we specifically support that. https://github.com/borkdude/deps.clj/commit/4417bb69a665a6787e3c05b0ab94a3620510fb62
ah
let me try
if it doesn't work, I consider it a bug
that works!
CLJ_JVM_OPTS only affects deps.clj and not the bb process that comes after, right?
correct
the process that downloads the tools jar is a clojure process at the moment
eh no
but it is a separate process
thank you sir
I've yet to get to the point where I can verify the PRELOADS thing but I'll signal back
👍
I'm finding that 1.12.216 broke with-redefs-ing org.httpkit.client/get
let me try and create a minimal repro
bb -e '(with-redefs [org.httpkit.client/get (fn [] :foo)] (org.httpkit.client/get))'
passes with 215 but fails with 216 and above0.232 ----- Error --------------------------------------------------------------------
0.233 Type: clojure.lang.ArityException
0.233 Message: Wrong number of args (0) passed to: babashka.impl.httpkit-client/get
0.233 Location: NO_SOURCE_PATH:1:52
0.233
0.248 ----- Context ------------------------------------------------------------------
0.248 1: (with-redefs [org.httpkit.client/get (fn [] :foo)] (org.httpkit.client/get))
0.248 ^--- Wrong number of args (0) passed to: babashka.impl.httpkit-client/get
0.248
0.249 ----- Stack trace --------------------------------------------------------------
0.249 org.httpkit.client/get - babashka/impl/httpkit_client.clj:36:1
0.249 user - NO_SOURCE_PATH:1:52
0.249 clojure.core/with-redefs-fn - clojure/core.clj:7690:1
0.249 user - NO_SOURCE_PATH:1:1
0.249
------can you find one commit that could be related to this change? doesn't ring a bell to me directly
you can bisect with clojure -M:babashka/dev ... if you check out bb including submodules and make the right dev alias (can copy paste that here if you want)
this looks sus https://github.com/babashka/babashka/commit/96c4d58f4d8f12b0ac41638d705d28583fcf4bdf
issue welcome
(I haven't bisected it, just had a spot check through the commits)
yeah that may be it
not sure, but I'll find it
Thank you! I created https://github.com/babashka/babashka/issues/1979