Fork me on GitHub
#babashka
<
2021-07-13
>
borkdude10:07:55

Probably will release a new bb version tomorrow. Changelogs are updated. Recent binaries from master in #babashka-circleci-builds. Plz test 🤞

babashka 22
borkdude15:07:58

I take it that adding the babashka icon to the previous message means: "ship it" 😆

🚀 11
👍 6
😆 6
nate15:07:30

I just fiddled around with it a bit more today, no bugs found

escherize19:07:36

This snippet showcases the new string interpolation stuff:

(in-ns 'other-ns)
(def value ::there)
(in-ns 'user)
(def value ::here)
(require '[selmer.parser :refer [<<]] '[other-ns :as o])
(<< "value is: {{value}} | other-ns/value is: {{other-ns/value}} | o/value is: {{o/value}}")

;;=>
"value is: :user/here | other-ns/value is: :other-ns/there | o/value is: :other-ns/there"

2
borkdude19:07:47

I'm working on integrating this.

borkdude19:07:53

Are you on linux or macos?

escherize19:07:58

I am on a mac.

escherize19:07:24

oh, I was saying I am on that binary and it works

escherize19:07:32

or thats what I mean to say :)

escherize20:07:00

yep thats the one

escherize20:07:37

Thank you for rolling this in so fast! 🚀

borkdude20:07:35

I'm about to release it tomorrow, so just in time :)

2
borkdude20:07:36

@U051GFP2V should your << macro also support nil values? e.g. (let [x nil] ...) In that case I think (get env sym nil) won't do

escherize20:07:06

hmm, indeed nil will register as a missing value

borkdude20:07:14

and maybe more importantly false

borkdude20:07:46

(when-let [[_ v] (find env sym)] ...) is probably better

borkdude20:07:20

and in the resolve case you could use (when-let [v (resolve ...)] @v

👍 2
borkdude20:07:27

or if-let, etc

escherize20:07:24

yeah, I’ll look into this now

borkdude20:07:31

it's a common mistake I have made many times ;)

escherize21:07:09

Alright, I have a pr that fixes printing false values properly coming up shortly. For nil though.. In selmer a nil value is treated as a missing value, so I think mirroring selmer.parse/render there should be ok.

escherize21:07:37

e.g.

(defn missing-value-fn [tag context-map]
  (str "<Missing value: " (or (:tag-value tag) (:tag-name tag)) ">"))

(selmer.util/set-missing-value-formatter! missing-value-fn)


(render "{{here}} {{a-nil}} {{not-here}}" {:here 1 :a-nil nil})
;;=> "1 <Missing value: a-nil> <Missing value: not-here>"

borkdude21:07:57

The point is that you prefer local bindings over vars. So when you have (def x 1) (let [x nil] ...) you should choose nil as the value for x in the template.

escherize21:07:58

gotcha, this will be addressed too

👍 2
borkdude21:07:58

looks good!