Fork me on GitHub
#babashka
<
2020-05-09
>
borkdude12:05:15

pods are now available on the JVM as well: https://github.com/babashka/babashka.pods also an illustrative test how to add load-pod to your sci-based project

jeroenvandijk12:05:38

Wow, just amazing really :)

jeroenvandijk12:05:24

Don’t forget to go outside today, it’s beautiful weather in our country πŸ™‚

borkdude13:05:09

Just went for a run

borkdude16:05:12

bikeshedder: BABASHKA_RUN_AS_POD or RUN_AS_BABASHKA_POD as an env var for binaries to instruct them to run as a pod?

borkdude16:05:49

most env vars around babashka start with BABASHKA_, but BABASHKA_RUN_AS_POD could be confused with the intent of running babashka itself as a pod?

lilactown16:05:43

I like the prefix

lilactown16:05:12

maybe BABASHKA_POD=true ?

borkdude17:05:08

@lilactown yeah, let's do that one

borkdude19:05:46

released a new clj-kondo version that can be used as a pod with babashka (0.0.94): https://github.com/borkdude/clj-kondo/#babashka-pod

mauricio.szabo22:05:43

Hi, I'm using SCI on a project, and I need to evaluate some code, capture def and defn, and check their values after that evaluation. Currently I'm using {:env state} (state being an Atom) and capturing the result with:

(.-root  (get-in @state :namespaces 'user '<my-var>])))
is this the right way? Or is there a better way of doing?

mauricio.szabo22:05:05

(BTW: great job on SCI!)

borkdude22:05:55

@mauricio.szabo You can do it that way, but the organization of the atom is an implementation detail. If you want to be safe, do it like this:

mauricio.szabo22:05:53

(I imagined that it was an implementation detail: it read like it's private-ish πŸ˜„)

borkdude22:05:57

(def state (atom {}))
(eval-string "(def x 1)" {:env state})
(eval-string "x" {:env state}) ;;=> returns value of x that the user defined

borkdude22:05:38

does that make sense to you?

mauricio.szabo22:05:16

Yes, it does - but is there a way to find which vars where defined only on that namespace? Like, I can use ns-map but it brings me everything that was required, refered, etc...

borkdude22:05:41

@mauricio.szabo in that case I think you should capture the user namespace before and after and compare those

mauricio.szabo22:05:38

Oh, nevermind - I can use ns-publics πŸ™‚

borkdude22:05:17

Right, so:

user=> (def state (atom {}))
#'user/state
user=> (def before (sci/eval-string "(keys (ns-publics 'user))" {:env state}))
#'user/before
user=> before
nil
user=> (def after (sci/eval-string "(def x 1) (keys (ns-publics 'user))" {:env state}))
#'user/after
user=> after
(x)

borkdude22:05:08

afk now, gnight