4 ms·
I've been checking out Babashka [1] recently. It allows you to write clojure scripts and output a single-binary with fast startup time. Then I did a very brief
by ducktective 5y ago
I've been checking out Babashka [1] recently. It allows you to write clojure scripts and output a single-binary with fast startup time.
Then I did a very brief search for clojure libraries, things like parsing html. Most of the github projects were not seeing much activity (like last commit in 2020).
I've found bash-as-glue of unix programs like ImageMagick, curl, jq and pup very practical [2]. I was just looking for a possible alternative to be sure I'm not missing out. Doesn't seem like it.
Anyone wants to hop in and sell me on his own approach?
[1]: https://babashka.org/ https://babashka.org/
[2]: https://news.ycombinator.com/item?id=31142635 https://news.ycombinator.com/item?id=31142635
- jonahbenton 5y agoOne data point, from a registered bashochist, and a clojurist- I think he's on to something for Clojure-based build tooling. bb is much more ergonomic than the tooling Cognitect is themselves providing. But I don't see it getting into my main non-clj shell workflow. That's even though I really don't like having to appease jq's opinions of aggregate hierarchical querying. But there's too much unique value working directly in the shell in most cases. Where the shell work dips directly into areas clj is strong- pure data processing- I have recently been thinking that maybe bb could make it easy to create a full clj repl environment, so I wouldn't have to suffer through jq. But that wouldn't be doing the work in a shell with bb. It would be doing the work in a repl. FWIW. One other point- lack of activity on clojure libs is not the red flag it is in other languages. There's much, much less of the churn and grind that there is everywhere else in the ecosystem. When there is something novel that doesn't have a native clj implementation, it very likely will in Java, and pulling that into clj- even straight from java source on github- is easy. HTH. Cheers.
- ducktective 5y agoYou see, I keep asking myself, when I want image processing, I reach for IM. video processing? ffmpeg. Json/XML/any structured data? jc | jq. It's hard to beat this workflow. Like, what possible ""java"" library is gonna beat the ubiquitous unix tools?
- jonahbenton 5y agoAgree. Though- of tangential interest, on the margin- For a commercial project I have been dipping into webassembly, and figuring out how to run wasm inside a JVM. The setup ergonomics are terrible, because it's native code land. But it works, and performance is spectacular. With all the build tooling targeting wasm, maybe there is a crazy future where native engines become pervasively available under wasm, and therefore inside a JVM.... This is not far from where Python has been- for 20 years. Its mechanical sympathy with native libraries is a big part of its current supremacy. But Py is a poor shell and repl, and most cli tools don't ship as engine libraries. So nothing yet competes with bash on the file system chaining together executables. Should there be widespread wasm, though, in THAT world, a Clojure repl with a nice menu of engines, caches, stores, all just functions and data- those ergonomics might get some people to switch... (fantasy goggles off now)
- ducktective 5y agoThanks for sharing your insight
- iLemming 5y ago> Json/XML/any structured data? jc | jq. Except that once you try EDN, you wouldn't want to deal with JSON anymore. EDN is a lot nicer - it's compact, doesn't contain "syntactical garbage", and easier to read and modify. To deal with API requests I use github.com/borkdude/jet, another useful tool from the author of babashka.
- didibus 5y agoNothing prevents you from using babashka and still use it as a glue for Unix programs. The difference is you get a nicer language (my opinion), a REPL if you want, and also you do get access to a lot more libraries from Java and Clojure and the pod concept if you need too as well, sometimes for more advance use cases. So to be clear, you can easily use ImageMagick, curl, jq, pup, etc. See: https://clojure.github.io/clojure/clojure.java.shell-api.html https://clojure.github.io/clojure/clojure.java.shell-api.htm... and https://github.com/babashka/process https://github.com/babashka/process Other benefits are that you only need to learn Clojure and suddenly you can use it for everything, backend apps, frontend apps, scripts, etc. You don't need to learn bash, js, java, go, make, etc. > Then I did a very brief search for clojure libraries, things like parsing html. Most of the github projects were not seeing much activity (like last commit in 2020) This surprises everyone, but those libraries still work, have no bugs, are missing no features, and can be used without issues in production. Clojure is one of the most stable language, so things never break and almost never need updating. People have a kind of Stockholm syndrome I think coming from other languages that if something didn't need a bug fix in a year it must be abandoned and broken. And the reason you often don't need to update those libraries to keep up with the environment, like OS versions, is because they all leverage existing runtimes under the hood like JVM and that's the one that updates. So they're all secure and kept up to date, working with new OS and new architecture for free as JVM updates. This applies to Babashka as well, because it is implemented using a JVM.