6 ms·
Similar story. I'm also running my SaaS on Clojure and maintenance has been a dream compared to other languages. Things rarely break and are easy to upgrade. D
by drikerf 3y ago
Similar story. I'm also running my SaaS on Clojure and maintenance has been a dream compared to other languages. Things rarely break and are easy to upgrade.
Developer experience is fantastic too with HMR, REPL and cljc files. It's fun to write Clojure code :)
- weikju 3y agoHMR?
- G4BB3R 3y ago"Hot Module Replacement (HMR) is a feature in some programming languages and frameworks that allows developers to update modules or parts of the application in real-time while the application is running, without requiring a full page refresh. This is particularly useful during development as it speeds up the development process and helps maintain the application state."
- weikju 3y agoHmm I’d rather hear more from the GP (assuming it’s the same concept) and specific tools being used than a generic GPT sounding reply. Thanks though at least I learned an acronym (no snark).
- eddtries 3y agoFwiw it's a quote from https://webpack.js.org/concepts/hot-module-replacement/ https://webpack.js.org/concepts/hot-module-replacement/, what else would you like to know about HMR?
- monsieurbanana 3y agoI can't blame you for thinking it was a GPT reply these days. Anyway I'm also not GGP but he's right, it is Hot Module Replacement. You don't really need specific tools for HMR in clojure, it's kind of baked in the language thanks to: - immutability (not impossible but hard to do HMR without it) - REPL workflow When developing on clojure, there's a long-lived clojure process and you continually send expressions to be evaluated there. Let's say you start a server, you make a change to one of the functions that handle a route, just after making the change you will evaluate that function (from your editor) and the update will be "live" in the running server. It's honestly hard to describe and it doesn't help that we call that "repl-based workflow" when in fact we are not using the REPL directly, but rather through plugins available for various editors. People might think it's the same as using nodejs or python repl, when it's nothing like that. If you're interested, you could check "Parens of the Death" or look for "Clojure CALVA" (VSCode's clojure plugin) videos on youtube. https://www.parens-of-the-dead.com/s2e1.html https://www.parens-of-the-dead.com/s2e1.html Edit: It is also not limited to development. Nothing prevents you from hooking into the clojure process in your prod server from your editor, editing a function and evaluating it. You just monkey-patched a live server to fix a time-critical bug with roughly the same workflow as editing your code locally. Or brought production down, 50/50, but what's life without some risks eh?
- 38529977thrw 3y agoJust for the record, in Java (JVM) this is done (routinely circa first 'bean containers' of ancient history) via interfaces and class loaders. Using Java I can have n distinct versions of a class each implementing the same interface in the same process as long it is the interface reference that is passed around. > immutability Make a case for immutability being so critical to HMR. How does an immutable data allow for swapping of code.
- groestl 3y agoAFAIK, Java's native HMR is not built on dynamic classloaders, but using a separate technology built into the JVMs debugger support, called HotSwap. You can only replace (certain) function bodies with it. To get around these restrictions, more elaborate HMR can be achieved with classloader magic, such as OSGi, but you subscribe to a world of ClassCastException-pain with it.
- mattsan 3y agoHave you ever used a dictionary?
- mattsan 3y agoApologies for the tone. Was really tired when posted.
- travisjungroth 3y agoIf you want better answers, ask better questions.
- weikju 3y agoThanks all for the various answers. I guess, coming from common lisp where it's easy to add a new dependency (via asdf / quicklisp) to a running REPL, it's not so easy (yet? until 1.12?) with Clojure. Various utils have been created over the years, so was just wondering if there was something more to the picture that fell under this new term I learned, "HMR"..
- packetlost 3y agoWhat do you use for an editor/IDE? I'd love to write more Clojure, but the tooling story is a bit confusing
- Volundr 3y agoIn my case, Emacs+clojure-mode+cider. I'm not sure I recommend learning Emacs at the same time as Clojure though. I usually recommend new users look to Cursive(for IntelliJ) or Calva (vscode) depending on what they are most comfortable with.
- packetlost 3y agoI'm a vim user and there's no way in hell I'm switching to emacs, even with EVIL mode. I'll check out Calva
- Volundr 3y agoHopefully someone will chime in with their recommended setup for vim. I think there is pretty mature tooling available, but I'm not immediately familiar with it, so my advice there would be no better than Google. Calva is a solid choice if you don't mind switching editors.
- fiddlerwoaroof 3y agoI forget what the current recommendation for vim is, but back when I still wrote a lot of Clojure, people used vim-fireplace. I think there is a newer one for NeoVim, though
- fiddlerwoaroof 3y agoI too resisted emacs for years while writing Common Lisp in vim, but eventually I ported my vim config line by line to the emacs lisp implementation of the vi standard
- epiccoleman 3y agoAlmost ten years ago, I gave a lightning talk about Overtone (Clojure mappings for SuperCollider). I used "vim-fireplace" to connect to cider-nrepl and had a pretty good experience being able to quickly eval sexps in Vim. I'm sure this is wildly outdated by now - I'd be shocked if there wasn't something halfway decent in the NeoVim ecosystem. I will say, though, that during a brief flirtation with Spacemacs, I absolutely loved the Clojure integration - emacs just feels like it's more "at home" with lisps. Some of the most satisfying programming experiences I've had, honestly.