News for hackers. Stuff that matters.
Re:A History of Clojure [pdf] by bangonkeyboard on Thursday June 04, 2020 @01:53PM (#23419634)
I was at a talk by Guy Steele where he mentioned in passing that Clojure was a Lisp which had done everything right. This was all the more impressive to him because Rich Hickey had until then been a relative outsider to the Lisp/Scheme community.
Re:A History of Clojure [pdf] by jwr on Friday June 05, 2020 @03:30AM (#23425955)
I think what Rich got right is the practical approach. Clojure is about compromises (like all engineering). It's not a theoretical exercise, it doesn't prove a point, it's about getting things done.

This also means that sometimes things do not seem as "beautiful" as one might like. Well, that's because they aren't. There is no way to sugarcoat certain things without making the language less practical, and Clojure seems to have been designed with no sugarcoating in mind.

Incidentally, I love this quote from Rich, an answer to people complaining that Clojure isn't easy to learn: "Instruments are made for people who can play them". I've grown to appreciate that over the years. You don't expect to be able to sit at a piano of a particular brand and just start playing it.

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.
Re:A History of Clojure [pdf] by rodeph on Thursday June 04, 2020 @07:17PM (#23423133)
High praise indeed! Can you provide a source for it? It would be nice to be able to cite it.
Re:A History of Clojure [pdf] by bangonkeyboard on Thursday June 04, 2020 @07:39PM (#23423326)
I can't, sorry. This is my paraphrased recollection of his response to an audience question from years ago, and a quick search doesn't turn up any recordings.
Re:A History of Clojure [pdf] by zitterbewegung on Thursday June 04, 2020 @01:58PM (#23419694)
Yea Clojure is like the Python of lisp style languages. Good language design and it can interact with Existing Java libraries. (Python does the same thing but with C).
Re:A History of Clojure [pdf] by airstrike on Thursday June 04, 2020 @02:36PM (#23420134)
> Python does the same thing but with C

Don't think that's really accurate.

You don't have to use C with Python, and there's no VM to worry about. CPython* just happens to be the most popular implementation.

Clojure (by and large)* requires the whole Java infrastructure, and that is a nonstarter for many.

Re:A History of Clojure [pdf] by jdminhbg on Thursday June 04, 2020 @02:41PM (#23420195)
> Clojure requires the whole Java infrastructure, and that is a nonstarter for many.

There are Clojure implementations that run on JS runtimes, the .Net CLR, the Erlang BEAM runtime, etc.

Re:A History of Clojure [pdf] by sitkack on Thursday June 04, 2020 @07:27PM (#23423233)
Re:A History of Clojure [pdf] by roguas on Tuesday June 09, 2020 @12:33PM (#23468084)
It requires jvm. But you don't have to interact with java, sometimes its easier to just use a particular java library, but many people report never having to touch java. JVM seems like a nice to have, a lot of the standard java tooling works for clojure as well (profilers and what not).
Re:A History of Clojure [pdf] by lvh on Thursday June 04, 2020 @03:37PM (#23420831)
Nit: CPython, not Cython. Cython is a whole different thing that leverages CPython to compile Python programs to C, as well as compile Cython-the-language, effectively annotated Python, to faster C.

CPython comes with its own VM: are you saying the issue is "you need to install 2 things instead of 1"?

Re:A History of Clojure [pdf] by kgwgk on Thursday June 04, 2020 @02:14PM (#23419886)
Common Lisp also does the same thing with C.
Re:A History of Clojure [pdf] by mumblemumble on Thursday June 04, 2020 @02:29PM (#23420058)
And Hy does the same thing but with Python.

I think, though, that the things that Clojure gets right go way beyond just the JVM, though. Clojure's approach to nil punning, for example, is really well thought out.

Re:A History of Clojure [pdf] by jlarocco on Thursday June 04, 2020 @03:48PM (#23420941)
"nil punning" has been a feature in Lisp since the earliest days, but as far as I know it's only called "nil punning" in the Clojure community.

I don't have anything against Clojure (well, I'm a little negative on the JVM), but I personally don't see any reason to move to it from Common Lisp.

On the other hand, I'd miss CLOS, and I feel like CL has a better/more consistent design. Something about Clojure always feels like they're "winging it".

Re:A History of Clojure [pdf] by fmakunbound on Thursday June 04, 2020 @02:34PM (#23420110)
nil punning?
Re:A History of Clojure [pdf] by mumblemumble on Thursday June 04, 2020 @02:40PM (#23420181)
Eric Normand explains it better than I could: https://lispcast.com/nil-punning/

In a nutshell, nil punning is a thing in lisps (and some other languages) where the null value can have different meanings in different contexts. It's comparable to Python's concept of "truthiness" and "falsiness", but more so.

Re:A History of Clojure [pdf] by fmakunbound on Thursday June 04, 2020 @02:47PM (#23420270)
Oh that, yeah that's what I'm used to from Common Lisp as well.