Terminal Autism (terminalautism@social.076.moe)'s status on Monday, 26-Dec-2022 12:59:27 JST
-
Yeah, I think that's a good way to go. The old and stable languages aren't perfect, but the newer ones are generally even farther away from perfection, and are also less reliable. C and PHP are both in that category. Along with Perl 5, I guess, that's the general scripting language equivalent of that.
The benefits of Lisp are many. It's more powerful than a scripting language, but it's compiled and the dynamic typing is optional (you can manually set types for variables, arguments and returns, you just don't have to, it's optional because it's fucking freedom), so it's about as fast as a garbage-collected language like Go. At the same time, you have the most powerful macros of any language, a consistent syntax, and the language itself is easy to extend, and it's about as interactive as it gets because you can connect a REPL to a binary and run functions in it through the editor, and change the program in memory in real time. Hell, you can interactively do things in graphics and see what you're doing as you do it ( https://vid.puffyan.us/watch?v=XLkUI89fgRI https://vid.puffyan.us/watch?v=gj5IzggEWKE ).
Like, if you write a program in C, you have to restart it after rebuilding it, unless you use an extension language (some programs even come up with their own extension or command languages, while with Lisp that's not necessary at all, because it's such an interactive language). If you write it directly in the extension language, it's more flexible, but slow. Lisp, on the other hand, is compiled, but you can change the running Lisp image itself interactively and in real time, from the editor itself (you can just select code in Emacs and run it in the running program). On top of all of that, there are a lot of implementations and it runs everywhere. Even just Common Lisp, you can run it on Java, you can run it on JavaScript, you can compile it to C, or you can compile natively, or you can interpret it. It can all be done.
Common Lisp is also old as shit and pretty stable, to the point that people have been able to run programs from the 80s on it, in recent times. Any new features can be pretty easily added in the form of libraries. Not many people use the language, but it's also a good language for loners to do everything on their own. There's also Scheme (good first one to learn), and Clojure, and PicoLisp (it's small and can run on bare metal).
There are a few negatives, but not many. I don't know if you can turn off the garbage collecting and manage memory manually. Except maybe with CFFI (you can call C functions from Lisp too, interactively). There is a Lisp without GC and without dynamic typing, called Carp, but that's a different Lisp entirely from the rest. Even then, there is an OS written in CL, called Mezanno. Also, generally programs are built with an entire Lisp image, so binaries tend to be big.
From what I read, performance drops too drastically if you load libraries and don't build standalone executables. There's compression, but it makes startup slower. Though I guess you could be a madman and load and build all of your programs into a single image, because why not? Other than that, there is no downside. Other than I guess getting used to the syntax, coming from a world of every language being basically C. Though editors help with that, with highlighting, and there's also stuff like paredit that let you move parentheses and s-expressions around.
Oh, there's also the high barrier to entry, because you have to learn a whole new environment, it's like learning an OS, except it's one that few people use and write about. And you basically have to know Emacs, though there is another editor in development, lem, that may eventually be a very good alternative because it's multithreaded (Emacs is not, because it's ancient and very afraid of breaking backwards compatibility) and is actually written in CL, so it's built with SBCL, and should perform better than Emacs, even with the recent native compilation that it got. The other older editors, like Hemlock, are all dead.
Also, apparently the smallest real programming language in existence is a Lisp, and it's even garbage-collected. Pretty surprising, I thought for sure that it had to be a Forth.
And it's worth mentioning that there's a web server for it ( https://vid.puffyan.us/watch?v=A4PzSsOD-CQ ). And SBCL can also be used for scripting, with the --script option. I haven't messed with the web server yet, but I have with some web scraping, using a scraping library, and also a library that has Perl's regular expressions. I should do more GUI stuff in it. Anything involving graphics, I haven't done much at all, other than making basic windows spawn. Of course, you can do that in the REPL, in Lisp. Maybe I'll learn sdl, and see if I can make my own GUI with that. Could be neat, especially when it really does seem like GUI toolkits are all kinda shit (though McCLIM is neat). https://social.076.moe/url/25606