This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-12
Channels
- # babashka (37)
- # beginners (27)
- # biff (1)
- # calva (18)
- # cider (45)
- # clj-on-windows (5)
- # cljsrn (1)
- # clojure (90)
- # clojure-art (3)
- # clojure-uk (1)
- # clojurescript (7)
- # core-logic (4)
- # datomic (4)
- # events (2)
- # fulcro (3)
- # hyperfiddle (23)
- # leiningen (66)
- # malli (1)
- # meander (7)
- # nrepl (1)
- # off-topic (9)
- # pathom (1)
- # re-frame (15)
- # reitit (19)
- # remote-jobs (1)
- # shadow-cljs (103)
Turns out that zprint is (mostly) compatible with babashka :) https://github.com/kkinnear/zprint/pull/228

Also the expectations library (need to define clojure-version
only for the tests)
$ BABASHKA_PRELOADS="(intern 'clojure.core 'clojure-version (fn []))" bb test:bb
Testing expectations.clojure.test-test
Running inline tests
Ran 22 tests containing 82 assertions.
0 failures, 0 errors.
And hugsql.core sqlvec fns also works in babashka :) (from the next release on)
(deftest sqlvec-test
(is (= ["select name, specialty from characters\nwhere id in (?,?)" 1 2]
(characters-by-ids-specify-cols-sqlvec {:ids [1 2], :cols ["name" "specialty"]}))))
$ bb -e '(clojure-version)'
"1.11.0-beta1-SCI"
$ bb -e '*clojure-version*'
{:major 1, :minor 11, :incremental 0, :qualifier "beta1-SCI"}
I'm very to close to making specter run from source now...
Ran 135 tests containing 465 assertions.
0 failures, 6 errors.
{:test 135, :pass 459, :fail 0, :error 6, :type :summary}
Just a nasty reflection issue in a combination of clojure.lang.IReduce
and clojure.lang.IReduceInit
+ reify
thanks for keep making babashka more and more awesome š
Deftype is off the table for babashka, right? Just double checking
as I understand it, deftype dynamically defines a new Java class, and GraalVM doesn't allow for the creation (as in definition) of classes at runtime, so they're incompatible
interesting, I have deftypes all over #sicmutils but Iād be happy to compile classes instead, or use some form graal, js and jvm would be happy with. Is there an alternative?
Deftype isn't implemented since people usually use it for low level stuff and implement more than 1 java interfaces in them which is hard to support since you need to know all combinations at babashka compile time. Defrecord is the closest alternative
We could add support for a subset of deftype usages, but it would have the same restriction as defrecord: only 1 Java interface may be implemented at a time
It works with SCI bindings, but this is a different usage than running it entirely from source in SCI
yes. we could support deftype
for some cases, similar to how we support defrecord
but usually people implement all kinds of interfaces on those things that make it very hard to pull it off correctly
In sicmutils the usual pattern is to make something feel like a vector, but override IFn and add more SICM-specific protocols
Okay, I'll make a task to get the full list of deftypes together and we'll see what we can do
This is a good example of deftype
that is very hard to support in babashka.
https://github.com/Engelberg/instaparse/blob/4d1903b059e77dc0049dfbc75af9dce995756148/src/instaparse/auto_flatten_seq.cljc#L87
https://github.com/sicmutils/sicmutils/blob/main/src/sicmutils/structure.cljc#L83-L296
here is the sort of thing @U04V15CAJ that we are dealing with. most look very similar to this
I also wanted to ask if you have a suggested way that I could incrementally make this conversion; for example, make a,
or something and start growing up toward sicmutils.env
That sort of deftype is similar to the one from instaparse: it implements a bunch of stuff to make it a custom data structure with lots of interfaces which isn't possible in bb.
You can use either reader conditionals, :bb
or the .bb
extension to override code for bb
bb accepts both :clj
and :bb
reader conditionals, if you are using :bb
you must place it before the :clj
one
Is the answer perhaps to write the class in Java?
The answer, if you want to make your code bb compatible, is probably to use reader conditionals and support a subset