This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-24
Channels
- # adventofcode (6)
- # announcements (4)
- # aws (21)
- # babashka (36)
- # beginners (58)
- # calva (3)
- # cider (2)
- # clj-kondo (21)
- # clojars (3)
- # clojure (35)
- # clojure-dev (4)
- # clojure-europe (5)
- # clojure-nl (8)
- # clojure-uk (8)
- # clojuredesign-podcast (7)
- # clojurescript (10)
- # core-async (3)
- # data-science (2)
- # datomic (2)
- # defnpodcast (11)
- # duct (4)
- # figwheel-main (1)
- # fulcro (34)
- # graalvm (12)
- # graphql (4)
- # joker (14)
- # kaocha (1)
- # midje (1)
- # off-topic (5)
- # pedestal (1)
- # re-frame (3)
- # reagent (4)
- # reitit (1)
- # shadow-cljs (4)
- # testing (12)
i think it would be nice to have an extension specific to babashka for tooling support. however, there is also the idea of somehow being able to interchangeably use clojure files in some cases. haven't quite figured out whether one or the other is preferable overall or whether it's good to use one in some cases and the other in other.
to give some background, some tooling (e.g. chlorine for atom) was using the extension to determine what functionality to execute. this turns out to be at least a bit problematic for clojure clr files because they, like jvm clojure, also use .clj. i guess that got decided before reader conditionals where one expresses the use of clojure clr using :cljr...
@deleted-user why is .bb not great, can you explain?
FWIW I’ve been using .clj for scripts that are portable so people without a bb installation can also run them
On the classpath .bb files have priority over .clj and .cljc. In reader conditionals :bb has priority.
I don't know what he had in mind. The only reason I can find it's that you might want to use a regex .cl+
to match clojure-something
files
yeah, I don't think we're going to do .cljb or something. it's kind of an unwritten rule to not name your tools after clojure, I think the same might apply to file extensions
I'd say just use .clj or .cljc (reader conditionals) unless there's a reason not to.
I've been using .bb
for files that apply to babashka only and .cljc
for common code (like in the clj/cljs situation)
I have a bump-version script here which can be ran with babashka and clojure, so that's why I called it .clj: https://github.com/borkdude/babashka/blob/master/script/bump_version.clj
What I like about .cljc
is that it also indicates that it can be used by multiple platforms. To me .clj
only promises to run in Clojure. It could be misleading for cljs readers maybe though
bb v0.0.49 adds clojure.main/repl
:
https://github.com/borkdude/babashka/releases/tag/v0.0.49
Added a section on known babashka libraries: https://github.com/borkdude/babashka#libraries If you have published any useful ones, feel free to add
Just playing around now. Does this mean loading the http library takes around 50 ms?
➜ ~ time bb -e "(prn 1)"
1
bb -e "(prn 1)" 0.01s user 0.01s system 80% cpu 0.019 total
➜ ~ time bb -e "(require '[clj-http.lite.client :as client]) (prn 1)"
1
bb -e "(require '[clj-http.lite.client :as client]) (prn 1)" 0.04s user 0.02s system 91% cpu 0.066 total
➜ ~
you can maybe speed it up by removing clojure and some spec stuff from the classpath
btw, you can still shell out to curl as well, so this is an experimental phase where it's not yet clear what should go into babashka and what shouldn't. so for now it's a library
$ echo "$(clojure -Sdeps '{:deps {limit-break {:git/url "" :sha "f44ebe45446f0f44f2b73761d102af3da6d0a13e"}}}' -Spath)" | bb -i \
"(->> (str/split (first *input*) (re-pattern (System/getProperty \"path.separator\"))) (remove #(re-find #\"clojure\" %)) (str/join (System/getProperty \"path.separator\")))"
"src:/Users/borkdude/.gitlibs/libs/limit-break/limit-break/f44ebe45446f0f44f2b73761d102af3da6d0a13e/src"
> but maybe 50ms isn't too bad Yes I agree. I can imagine it will grow with bigger libraries, but something to figure out. The GraalVM approach could potentially solve that I guess
if startup time becomes a problem as a result of loading libraries you might as well turn to the JVM instead at that point and pay the 1.5 second startup penalty
good point
The new logo just arrived in time for Christmas! https://github.com/borkdude/babashka
@steveb8n Your Base64 request came just in time: https://twitter.com/borkdude/status/1209505224005767168