4 ms·
I have used Clojure on and off for probably 7 years. But when I tried to distribute my program which was a CLI tool, it proved incredibly painful. Clojure start
by djha-skin 4y ago
I have used Clojure on and off for probably 7 years. But when I tried to distribute my program which was a CLI tool, it proved incredibly painful. Clojure startup time is really bad over a second in the best case and it gets worse the more libraries you include. This is not a problem if you are writing a web application, but it's terrible for command line applications. The community seems thoroughly disinterested in solving this problem except with graalvm's native-image. I've done that route and believe me it's so painful.
Common Lisp has everything Clojure has. It feels like Rich Hickie took everything that he liked about Common Lisp and put it into Clojure. Many of the functions in Clojure were basically copied from Common Lisp: if-let, conj(oin), disj(oin) are some examples of core Clojure functions and macros that were totally stolen from Alexandria.
Even better, most CL implementations can save directly to an executable file. Embeddable Common Lisp is my favorite because its executable files are measured in kilobytes, something I could never do with native-image. And the startup time is amazing.
I did look at other lisp languages when deciding to move away from Clojure. However, Racket's standalone executables (raco exe) include the interpreter, and so are huge; Chez Scheme's ecosystem doesn't have a YAML library as far as I can tell, ditto for Chicken. Also scheme's library ecosystem in general (sans racket) is a bit lacking to me.
Common Lisp it is. It has its warts, but they're not too bad. It's long history also speaks of stability though. SBCL is crazy good optimized.
- ducktective 4y agoLast I checked, ECL binaries are around ~10-20 MiB (including the shared file) and the price of having these binary sizes is start-up time which is around 500-1000ms. BTW, since you program professionally in CL, do you use Emacs? Doom or custom?
- djha-skin 4y agoTo be clear, unfortunately I do not program professionaly in CL. I use vim + vim-slime (jpalardy) + GNU screen + rlwrap. dotfiles here[1], here[2] and here[3]. Blog post about this will be written subsequently at https://blog.djha.skin https://blog.djha.skin . 1: https://git.sr.ht/~djha-skin/dotfiles/tree/main/item/dot-config/nvim/init.vim https://git.sr.ht/~djha-skin/dotfiles/tree/main/item/dot-con... 2: https://git.sr.ht/~djha-skin/dotfiles/tree/main/item/dot-local/bin/clrepl https://git.sr.ht/~djha-skin/dotfiles/tree/main/item/dot-loc... 3: https://git.sr.ht/~djha-skin/dotfiles/tree/main/item/dot-screenrc https://git.sr.ht/~djha-skin/dotfiles/tree/main/item/dot-scr...
- ducktective 4y agoVery cool! Thanks for sharing the dots! I'm a vim user too, but recently I've been considering Common Lisp mainly due to this post: https://mikelevins.github.io/posts/2020-12-18-repl-driven/ https://mikelevins.github.io/posts/2020-12-18-repl-driven/ so I did a brief tour on Emacs (cause everyone uses sly) but both Emacs and CL take too much time so I've postponed them. Would be nice if you describe your vim+cl workflow and how does it hold up to Emacs+Sly+Org-mode ™
- djha-skin 4y agohttps://blog.djha.skin/blog/developing-common-lisp-using-gnu-screen-rlwrap-and-vim/ https://blog.djha.skin/blog/developing-common-lisp-using-gnu...
- ducktective 4y agoThanks!
- nanomonkey 4y agoClojure now has Babashka and better integration with GraalVM if you are interested in creating CLI tools. Worth checking out.
- brabel 4y agoFor CLIs, Common Lisp is excellent. I wrote a small program in CL and Rust, and (SB)CL can run faster than Rust EVEN FROM SOURCE! It's just completely mindblowing how fast it starts. If you don't believe me, write a program that does something like count how many times each letter appears in a text file in CL and Rust, then run them with `time`. I can pretty much guarantee CL runs as fast or faster. EDIT: my comment is meant for anyone curious about OP's clamis, I am obviously just agreeing with their point about CL's startup speed.
- ArtixFox 4y agoOoooh nice!!! That is amazing but how viable is common lisp for low level programming. Instead of embedding CL, what about a DSL that creates binaries, does something like this exist?
- ducktective 4y agoFor embedded application (as in micro-controllers) there is http://www.ulisp.com/ http://www.ulisp.com/ SBCL still needs garbage collection. There are also https://github.com/carp-lang/Carp https://github.com/carp-lang/Carp and https://github.com/bakpakin/Fennel https://github.com/bakpakin/Fennel I haven't used these. Would be great if low-level and embedded engineers could chime in.