96 points · by capableweb · 4y ago · 145 comments
IMHO. Maybe I overexaggerate. Anyway, the author, from my perspective has decided that clojure IS in fact for him, but clojure on the JVM is not, so he chooses to use a different one.
I've been told this a couple times. I doubt I'd thrive in that world though, unless I was selling something I actually gave a damn about.
IDK, is guile a scheme? guile is it's own thing, but it's definitely a scheme. What about racket? Racket has a whole bunch of stuff that mit-scheme doesn't. But it's still kind of in the scheme family. That's the parallel I was drawing. That and the statement that Hickey made in his History of Clojure that Clojurescript _was_ clojure, not some kind of spinoff.
I'm certainly not detracting from Janet and Fennel, but they _are_ quite close to clojure proper. There is a clear lineage.
I would generalize your observation as a logical consequence of Greenspun's tenth rule and conclude that we will eventually get a hosted lisp for any sufficiently relevant programing language.
However, the broader lisp community writes code very differently from typical clojure. Different idioms, slight syntax variations, completely different tooling and ecosystems.
While I can agree with you that for 'us' it certainly feels emotionally true. But if you go into other lisps scheme, racket etc you would notice huge differences. Differences which may feel even stronger than java vs c++ diff.
As someone who has written Ruby for years and more recently switched over to the JVM, I don't see the big deal. Both ecosystems have their advantages and disadvantages. The fact that so much of Ruby's ecosystem is built on C has its downsides too, e.g. compilation errors on "bundle install" because your version of nokogiri doesn't work with whatever C libraries are installed on your system anymore, or a frequent need to install new ruby versions which can be rather slow when you have to compile them from scratch.
Clojure (the JVM runtime variant) is not compiled to JVM bytecode. It’s compiled to Java implementations. This detail isn’t very hidden, and few affordances are made (or were when I worked in Clojure) to accommodate the indirection when something goes wrong. When you get an error, you’re now walking down this stack:
0. Debugging the build (which has all of these steps before you might even run code)
1. Debugging your own code
2. Debugging Clojure source written in Clojure
3. Debugging the Java implementation of Clojure
4. Debugging Java’s runtime behavior
Most often, Clojure the language doesn’t do anything to make step 1 or 3 any easier. It’s just a call stack from whatever .clj source into a Java stack with no context whatsoever.
This is incredibly hard to debug, especially because a lot of other important details are hidden. For instance:
(let [foo {…}] …)
Calls one of several kinds of HashMap implementations, and may call many others in the course of processing foo. All of these dump you into Clojure, the runtime.ClojureScript is fundamentally the same, except:
- It’s got a whole additional runtime to loop through
- The cljs maintainer is (or was when I was writing cljs) actively hostile to offers to contribute changes which would make this less painful. Literally close as wontfix, rejecting offers to contribute
Nearly 100% of these experiences are leaky language host marginalia (ie type errors caught in an unhelpful place at runtime). And I wanna be clear: I love the concept of Clojure and don’t regret any of the time I spent working in it (though I do regret some time with cljs). But the probability of encountering incredibly confusing host language stuff very quickly approaches 1 if you’re developing actual things for real users. And then it gets really “hope you have a good mental map in memory” really fast.
Or you're just annoyed that stacks includes Java frames? In CIDER you can make it only display frames from your own code or only Clojure frames. Then you don't need to see Java frames.. and it'll look equivalent to being compiled to bytecode...
When I did work in Clojure/Script, I would regularly find bugs I couldn’t understand without stepping through core libraries and the runtime to understand them. Often they were my own bugs, sometimes bugs or just non ideal behavior. Hiding the stack frames would have been a hinderance for these cases.
In actuality, Java is pretty great and a lot of the pain I experienced using it was not because there was something inherently worse about Java’s design decisions but rather because I had made the (very incorrect) assumption that one could simply port over a lot of the unstated assumptions we make about the semantics of other languages when coding in Java, which isn’t true.
Isn't that the crux of the general criticism of Java's generics though? That it's ugly and deeply limited precisely because it was designed around a hard requirement of backward-compatibility?
You know anything about .NET?
I guess I was trying to describe the frustration of switching languages and ecosystems while also trying to ship, thought I could do it, but I couldn’t.
I suppose I would have had a much better time and stayed in C-land (and gotten much better performance) if I had tried golang instead of clojure.
Almost every decision in Java feels like it was chosen to waste memory. Even using less than int size ints is hard, because it makes you write explicit casts everywhere, which doesn't prevent bugs, but then makes overflow wrap silently, which encourages them.
I've since abandoned janet for web app side projects and gone back to ruby entirely but yeah, I still love lisp but it makes more sense to align my work programming language with my side projects that way I can ship my side projects faster, at least that's the thought now.
As a Clojure fanatic, I too enjoy your writing and hoped to stir up some interesting discussions around Clojures weak-points by submitting this story.
According to the article, the author moved to Janet, because it is Clojure-like without the JVM overhead.
[0]: https://github.com/babashka/nbb [1]: https://babashka.org/
He analyzed his needs and wants.
This is a good example of what "right tool for the job" analysis looks like.
Though honestly, if OP wasn't in "java land" (his phrase), I'm not sure why Clojure was even on his radar.
I greatly respect people who reject the hype and just go with the language that fits their needs, even if it isn't hyped like C, Ruby or Python but provide plenty of what you'll need.
Clojure is really appealing as a language and has enough of a following that it doesn’t seem like a risky bet. It also looks pretty self contained. It’s only when you need to push it that you find yourself with confusing JVM stack traces and all the nuances of that ecosystem. When you do you start to figure out the whole thing is not quite as elegant and simple as it first appeared.
Today it would be something else, like rust or zig or something.
But yeah it's difficult for me to build my tools and ship finished web applications at the same time, it's compounded by learning a new language.
This is something I've struggled with for a long time. I still struggle with this, the urge to create a new web framework when I would have shipped much faster if I had just used some boring old one for example.
the pitfalls of old boring tech have known solutions, while the new tech may run you into trouble you don't know you can run into?
well, gee, that was totally worth the 50 slides that i had to scroll through (and i don't know why the website was so slow)
looks like a web-dev is coping with the realities of web-dev, nothing more
C libraries are wonderful tools when you need a low-level library to run hot, but if you need, I don't know, a database adapter or a queueing library and you don't want to write one, I'd much prefer pulling something out of maven than trying to integrate a C library. There's just a lot of infrastructure the jvm gives you pretty easily.
If you're just messing around with fun side projects, there's nothing wrong with using something you enjoy for no other reason than your own personal enjoyment.
That was my thought too. If it's a side project, I guess you should just always use Python because you will never need anything else. But I already kinda know Python and it doesn't interest me much, so I write my side projects in the flavor of the day that has my fancy at the moment.
I had to write some proof of concept code that talked ISO-TP on the CAN bus and guess which language other than C had libraries for CAN and ISO-TP? Python. Fortunately we found a serial to CAN gateway and I was able to do it in Ruby over the serial port. Soon we'll have to rewrite part of it in C/C++ on some embedded board, probably ESP32 because it has CAN and WiFi built in. But I think it's perfectly doable in micropython as well. ESP32 CAN bus support for micropython is currently being worked on.
The java-world is an inscrutable place of gigantic IDEs, maddening dependency graphs, perverse build systems. Everything is just-so-poorly-compiled enough that it's a nightmare to work with. It sucks all the joy out of programming in my experience.
And it's not like this is a slow language, Java is like 80-90% as fast as C if you know what you're doing, and for most use-cases, and isn't brain-dead in its handling of threads.
I'm a C++/Python developer, by the way, although I've had day jobs writing Java too. I honestly think this is way off base; it's a great language which has constantly evolved, and the JVM is a fantastic piece of technology. Rich Hickey was super smart in targeting the JVM, it was a great decision, and to my mind OP hasn't a clue of what he's talking about.
The idea is that there's a "cluster of C-based ecosystems" of languages whose open-source philosophy, programming culture, etc. "is just fun". In contrast with the JVM ecosystem which, I think, just isnt.
Or that of Python where the package managers _globally_ install dependencies and you need virtual environment shenanigans to not break everything???
It also seems that the JVMs original purpose of running the same code across operating systems/architectures has also been superseded by containers, better cross compilation (llvm) and possibly wasm as well.
Maybe at some point in the future, the JVM will mostly be relegated to legacy systems and most new software (assuming AI isn’t writing all future software) will target wasm or require some container runtime.
I mean sure, most modern JVM apps deploy to containers, but developing in container images is quite another thing and requires you to understand and debug a lot of issues (e.g. mounting, caching, networking) that you'd like not to care about (especially if you're not particularly an infrastructure/ops person).
C (and C++), on the other hand, is a trash fire of macros obfuscating code, header files (WTF they're still here in 2022?), libraries which are hard to import, barely working IDEs (IntelliSense in latest Visual Studio takes 30+ seconds to update itself after every change in my small C++20 pet project), people redefining primitive data types in a hundred different ways, unusable compiler error messages etc. Every time I have to work with C++, I'm getting angrier by the hour - and my codebase is only a simple personal project!
While IDEs were actually born out of Xerox PARC workstations and Lisp Machines.
Languages without such workflows, stuck in the days of teletypes are what suck the joy out of development experience.
> The Janet language is implemented on top of an abstract machine (AM).
Greenspun's tenth rule comes into my mind.
For comparison, the JVM has been developed for almost 30 years now, hundreds of thousands of hours were invested in it, runs virtually on every platform on a planet. It has advanced JIT and GC capabilities, and can compile to native.
Even Clojure has been around for about 15 years now, and it has successfully carved its niche in the Java world.
Janet on the other hand... is a 4 years old hobby project? No disrespect, but they are not in the same league.
Just a side note: it is probably the easiest thing in the world to implement your own LISP - it is a fun thing to do, you can start very small and get something working within hours. So if you are into it, you should probably roll your own too!
When you start with "no disrespect", with high probability what follows is disrespectful. Did he make the claim Janet was in the same league? He starts by clearly mentioning this is in the scope of his side-projects, so enjoyments trumps marketability.
clojure was cool, I used it mainly for datomic, but the gains really dont justify relying on public slack channels and mailing lists to hire and find devs.
I really see this from an economic point of view. I could be mistaken based on my own experience dealing with clojure and datomic in particular. I'm just not sure the gain is there anymore as other databases built on conventional tech stacks increasingly more or less take away the gains.
It describes how no technical improvement alone can get an order of magnitude improvement in software development efficiency, so the ways available to increase development by an order of magnitude are learning to use already-built components, shrinking feedback loops so we can be sure we are building the right thing, and growing the profession.
It would be nice though to understand what the author believes the issues with the JVM are since they they aren't expounded upon in the article.
The problems with the JVM are more cultural or political and not necessarily technical, although at the time clojure on the jvm did require quite a bit of memory and the cold startup times weren’t great for a simple, “watch this file in development and restart the server” workflow.
Fortunately, no one in the Clojure ecosystem works like that, thanks to the REPL :) You fire up the server, send code straight from the editor to the server and evaluate everything on the fly, no restarts needed.
Not sure how it is better than Ruby. But maybe the author wants something fresh to play with - that I can totally relate to. Good luck with the new journey anyway!
I guess he also never saw the price of ISO C document that someone has to pay so that GCC actually supports C the proper way.
Talk about being precise on the details.
In fact, one large banking system I worked on in the late aughts completely revamped their megalith of a back-end for a major component of their system and the only two things they didn't change were using AIX and Oracle.
I’ve always wondered if there’s a way to know at compile time whether a value is being mutated, rather than throwing a runtime exception.
And in any case, I'm wondering about compiler-writing resources, not compilers.
I daresay you didn't even read what I wrote and just typed "hurr, Rust is good." I've seen a million comments like this, and it's largely the reason I'll never bother.