This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-07
Channels
- # announcements (11)
- # architecture (2)
- # babashka (84)
- # beginners (226)
- # calva (7)
- # chlorine-clover (4)
- # cider (29)
- # clara (17)
- # clj-kondo (23)
- # cljs-dev (58)
- # cljsrn (60)
- # clojure (172)
- # clojure-europe (24)
- # clojure-finland (2)
- # clojure-italy (6)
- # clojure-nl (8)
- # clojure-spec (4)
- # clojure-uk (22)
- # clojurescript (44)
- # conjure (39)
- # core-async (64)
- # cursive (76)
- # data-science (15)
- # duct (3)
- # emacs (2)
- # events (5)
- # fulcro (30)
- # helix (4)
- # jackdaw (5)
- # juxt (1)
- # kaocha (1)
- # leiningen (4)
- # off-topic (9)
- # pathom (22)
- # re-frame (9)
- # reagent (33)
- # reitit (3)
- # ring (10)
- # ring-swagger (2)
- # shadow-cljs (192)
- # spacemacs (27)
- # specter (2)
- # sql (59)
- # vim (2)
connecting to babashka nrepl with cider is very nice... but autocompleting doesn't seem to work for me and bb prints stacks with: No namespace: babashka.signal found [at line 1, column 7]
% bb -e "(require 'babashka.signal)"
clojure.lang.ExceptionInfo: Could not require babashka.signal. [at line 1, column 1]
I don't know what that namespace is, but I can make an issue if I understand why CIDER needs it
You were just in time, I was really just hitting the release button for something else
Released v0.0.92 with pod support and released the very first pod: https://github.com/borkdude/pod-babashka-hsqldb Pods are new way of leveraging other command line tools as libraries in babashka. Please try it out. I'll write some pod documentation later this week after the first feedback.
Looks the same on my Mac π
Babashka pods are an exciting new way to extend babashka dynamically with features provided by other programs. They are introduced in babashka v0.0.92 released today. Babashka pod documentation: https://github.com/borkdude/babashka/blob/master/doc/pods.md


when I was trying out pods, I came across some odd behavior, which I think may just be hsqldb
my script:
#!/usr/bin/env bb
(require '[babashka.pods :as pods])
(pods/load-pod "pod-babashka-hsqldb")
(require '[pod.babashka.hsqldb :as sql])
(def db "jdbc:hsqldb:file:test.db;sql.syntax_mys=true")
(println "create")
(time (sql/execute! db ["create table if not exists entries ( id int not null auto_increment, name varchar(20) not null);"]))
(println "update")
(time (sql/execute! db ["insert into entries (name) values ('foo');"]))
(println "select")
(time (sql/execute! db ["select count(*) from entries"]))
result:
create
"Elapsed time: 102.321462 msecs"
update
"Elapsed time: 12.067853 msecs"
select
"Elapsed time: 13.738398 msecs"
[{:C1 33}]
create
"Elapsed time: 9284.601321 msecs" update
"Elapsed time: 11.258119 msecs"
select
"Elapsed time: 13.083133 msecs" [{:C1 34}]
I wrote another version that just used a custom bb compiled with next.jdbc and hsqldb and it never exhibits the slowdown
well, maybe the pod should receive a signal to close itself instead if being killed very harshly
I noticed that if I spun up a bb nrepl to execute my code, that it held a lock until I exited the process
oh, and in the "why didn't I think of this the first time" department, I added this at the end of my script and it made the sql go fast and the lock get cleaned up:
(sql/execute! db ["shutdown"])
@U0510902N I uploaded new binaries for the hsqldb pod which implement a shutdown op. The next bb will send this op and waits for the pod to exit. I've tested this locally and it worked
just made another change to both bb and the hsqldb binaries. I made a breaking change by introducing the new shutdown op, but now it's optional. So no breaky
@U0510902N Does this also error for you? https://github.com/technomancy/leiningen/releases/download/2.9.1/leiningen-2.9.1-standalone.zip
Humm....
(pods/load-pod "pod-babashka-hsqldb")
(require '[pod.babashka.hsqldb :as sql])
I wonder if that could be replaced with a single clever
(require-pod '[pod.babashka.hsqldb :as sql])
or is this going to far and conflating pod and namespace?I have been thinking about that too. There are two problems with this:
1) pods may expose multiple namespaces
2) pods sometimes need command line arguments and/or may not be on the path, so you have to load them like (pods/load-pod ["./foobar" "-Xmx" "4g"])
An alternative may be some environment variable which loads the pods automatically. But that might also not be such a great idea because you generally don't want to load a pod for all scripts
I just discovered that graalvm binaries automatically recognize -D
java properties
bb -Dfoo=bar -e '(System/getProperty "foo")'
"bar"
So we could do something like
bb "-Dbabashka.pods=[...]"
Cool π And at some point you probably want to think about versioning as well. E.g. this binary works with the binary version of X. But yeah, you are right letβs gain some experience first with this new super power :)
I just wrote a pod for toyokumo/tarayo, SMTP client library for Clojure (VERY EARLY) ! native-image is a to-do:disappointed_relieved: https://github.com/liquidz/pod-uochan-tarayo https://github.com/toyokumo/tarayo
Thank you for the update to npm Sci @borkdude. Now I can do fun stuff like this in hiccup π
[:a {"onClick" "(function(){sci.evalString('(fn [e] (js/alert \"hello\"))',{classes:{allow:\"all\",\"js\":window}})(this);return false})();return false"} "click me"]
Iβm trying to translate the cljs version [:a {:on-click (fn [e] (js/alert "hello"))} "click me"]