News for hackers. Stuff that matters.
Re:A History of Clojure [pdf] by globular-toast on Thursday June 04, 2020 @02:55PM (#23420361)
I just wish it didn't target the JVM. I think if it had a native runtime that loaded quickly like Python it would be more popular. I love Clojure and really wish I could use it, but I just don't do the kind of things that can justify running a JVM.
Re:A History of Clojure [pdf] by lvh on Thursday June 04, 2020 @03:32PM (#23420768)
This is definitely a valid criticism! Two ways that this may be getting better: GraalVM's native-image and babashka.

babashka is a little interpreter that implements large portions of "scripting Clojure" so you can write tiny Clojure scripts the way you'd write bash or Python.

GraalVM's native image is a Serious Compiler (unfortunately also with Serious RAM appetite and compile times, though this has gotten much better over the last few months) that will produce native binaries on Windows, macOS and Linux.

Re:A History of Clojure [pdf] by dorian-graph on Thursday June 04, 2020 @05:35PM (#23422133)
> babashka

I recently was looking for something like this and I also found Planck, Lumo, and Eden.

Do you (or anyone) know of a comparison between them?

Re:A History of Clojure [pdf] by joobus on Thursday June 04, 2020 @08:16PM (#23423615)
Planck uses the os native webview for execution. Lumo runs on node. Eden is compatible with most clojure libraries, and is meant for embedding. Babashka is a clojure interpreter written in clojure and compiled with GraalVM. I've used Planck and babashka for shell scripting and prefer babashka.
Re:A History of Clojure [pdf] by dorian-graph on Friday June 05, 2020 @03:42AM (#23426017)
Thank you, that was a good overview! I started giving Babashka a quick go and it looks like it'll work well for what I wanted to use it for.
Re:A History of Clojure [pdf] by brabel on Thursday June 04, 2020 @03:32PM (#23420772)
He explains how he created Clojure explicitly as a hosted language. After the JVM implementation, it quickly got implemented for CLR, and then JS (ClojureScript), and both are full implementations, not just look-alike.

By all accounts, though, Clojure became as popular as it is because of the JVM, not despite it.

Re:A History of Clojure [pdf] by JBiserkov on Thursday June 04, 2020 @09:43PM (#23424171)
Btw, Rich had two versions of Clojure - Java (JVM) and .NET (CLR) and shortly before releasing it he decided to focus on the Java one, and deleted the .NET one.
Re:A History of Clojure [pdf] by Skinney on Friday June 05, 2020 @02:34AM (#23425674)
ClojureCLR still exists and is somewhat maintained (last commit was last year, but then again, little has happened in the clojure world in the past year so I'd still use it): https://clojure.org/about/clojureclr
Re:A History of Clojure [pdf] by JBiserkov on Friday June 05, 2020 @07:37PM (#23435235)
Right. What I was trying to express was that there have been 2 Clojures on the CLR:

1) The original one, developed by Rich Hickey in 2005-2007, which he deleted before releasing Clojure

2) The second one, known as ClojureCLR, which David Miller developed in 2008 from the ClojureJVM.

https://soundcloud.com/defn-771544745/48-david-miller-and-cl...

Re:A History of Clojure [pdf] by kinleyd on Friday June 05, 2020 @06:57AM (#23427154)
I started out with that view too. Now, after many years of using Clojure, I have come to love the JVM: so many of the libraries it comes with have become critical pieces of my daily workflow.
Re:A History of Clojure [pdf] by elwell on Thursday June 04, 2020 @03:08PM (#23420520)
GraalVM, ClojureScript, etc...
Re:A History of Clojure [pdf] by didibus on Thursday June 04, 2020 @07:33PM (#23423274)
I find this very interesting, because it seems the programming landscape has changed quite a bit since Rich Hickey's world where he conceived Clojure.

How he describes information systems, in that world, JVM is an amazing piece of technology that can hardly be surpassed.

But today, the programming landscape goes far beyond that. ML and Data Science, infrastructure automation, serverless, etc.

I also work in the world of enterprise information systems, so I'm always surprised about people saying the JVM doesn't work well for them. For me the JVM is the best piece of tech out there, only matched by the CLR. Even Go isn't up to par yet.

But I reckon, other use cases value different execution characteristics. Low memory footprint is more important than raw performance. Throughput is more important than latency. Binary size is more important than portability. Startup times is more important than runtimes. Etc.

Well the good news is that Clojure is meant to be hosted. And the JVM is only one of its many hosts. ClojureScript can run on NodeJS, eventually Deno, it can run on JavaScriptCore and in the browser. All these offer alternative execution models which can meet a new set of requirements.

Clojure CLR is still real and robust, while it hasn't seen much use, it is ready at any time to take over. If the CLR provides to fulfill alternative execution characteristics it would be an option. Right now, the CLR has pretty much the same characteristics as the JVM though, which is why its use in Clojure hasn't seen a lot of popularity.

Babashka and Joker are Clojure based runtimes, interpreters really, so exactly the same as what Python and Ruby offer. Babashka especially is picking up pace, and already starting to offer a really compelling set of alternate execution characteristics, specifically one where startup time trumps all.

I'm also quite fascinated by Clojerl, a Erlang hosted Clojure. While less official, the maintainer is very active, and I feel it's actually now ready to be used in production.

And there are more, smaller ones, but I'll skip those.

What this shows is the landscape of possible runtimes is vast and will just keep expanding. Right now lots of experiment in having a Clojure hosted on Go, on Common Lisp, on Rust, etc.

This a testament to Rich's hosted design. Clojure is easy to build on top of other runtimes. This ease really helps it grow and reach more use case.

And there's the fact that the JVM is only getting better. GraalVM already offers native binaries with a small memory footprint, small binary, fast startup and still pretty fast performance. There are so many new garbage collectors coming along. Some for large heaps, small heaps, no heaps, tuned to throughout, latency, low memory, large memory, etc.

P.S.: Also, I really urge you to reconsider a JVM. The truth is, it's such a powerful piece of technology that it can be hard to navigate and understand even what all it can do. I believe a lot of people are turned off by that and choose to use Go or Python because they have only one easy mode of operation. But the JVM can do so much, it's a worthy investment, it's very possible it has what you actually need.

For example, you no longer need to install a JVM. Apps are self-contained. The user doesn't have to install a JVM, and the bundle contains only what the app uses, not the whole JVM. And as mentioned, compiled native binaries are also a possibility now.

Re:A History of Clojure [pdf] by JBiserkov on Thursday June 04, 2020 @09:50PM (#23424205)
You mentioned ML, so I just had to link to the awesome libraries by Dragan Djuric like ClojureCUDA, ClojureCL, Neanderthal, Fluokitten, Bayadera and recently Deep Diamond

https://github.com/uncomplicate

Re:A History of Clojure [pdf] by chrisseaton on Thursday June 04, 2020 @03:08PM (#23420507)
Hopefully that'll come with GraalVM.
Re:A History of Clojure [pdf] by keymone on Thursday June 04, 2020 @03:19PM (#23420648)
JVM is not to blame here, it's Clojure that takes a while to load and initialize. Java actually crushes Python in every aspect in terms of performance (which is to be expected of statically typed language).
Re:A History of Clojure [pdf] by lvh on Thursday June 04, 2020 @03:35PM (#23420812)
GP specifically mentioned startup time. It's true that most of the startup time for Clojure projects is a Clojure-specific interplay of things the JVM does (but also not language-intrinsic: ClojureScript on V8 does not share that problem, for example), but default flags CPython still beats default flags OpenJDK for "start and do nothing".
Re:A History of Clojure [pdf] by keymone on Thursday June 04, 2020 @03:57PM (#23421041)
> default flags CPython still beats default flags OpenJDK for "start and do nothing"

i stand corrected :)

Re:A History of Clojure [pdf] by dnautics on Friday June 05, 2020 @11:08AM (#23429405)
it's not the static typing that makes a difference, it's the compilation. As an extreme example, asm is very much not statically typed (hell it's not even considered typed in most circles), and it beats the pants off of Java.

As another, less flippant, example, Julia will typically beat Java in most long-running algorithms (but probably not time-to-first-x), because it doesn't have a well-optimized-for-compilation-speed compiler, but it does have a better-optimized-for-running-speed compiler for many scientific tasks. https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re:A History of Clojure [pdf] by igouy on Friday June 05, 2020 @11:48AM (#23429880)
In that example, Julia also has someone who's spent many many hours writing and re-writing those few tiny programs to tune performance.
Re:A History of Clojure [pdf] by dnautics on Friday June 05, 2020 @09:00PM (#23435835)
Last year I spent about twenty minutes writing mine (Julia #3) in the n-body example and it tied the naive java. I'm not even a Julia programmer anymore.
Re:A History of Clojure [pdf] by igouy on Tuesday June 09, 2020 @01:49AM (#23464045)
Thank you for that contribution. Since then many hours have been devoted to those programs.