Hello everyone! I think it would be fun to talk about elegant and expressive programming languages and also that it would help raise awareness for what's out there.
This is a thread I've been thinking of making for a while and finally decided to today. Programming languages are a special pet subject of mine and are near and dear to my heart and I am a bit of a "language dilettante", by which I mean I've tried dozens of different languages and indeed perhaps too many arguably since it has distracted me from doing more real project work. Nonetheless, I think there is great value in sharing what some of the most interesting languages are so that we can broaden each others' awareness of such. That will also help diversify the range of usage of languages out there a bit and thereby give people more options and creative joy in programming.
Anyway, here is my list of what I think are the top most interesting, expressive, and elegant programming languages in existence:
- Tcl/Tk: Sometimes referred to as "Lisp for C programmers", this is my current overall favorite elegant language for its balance of expressiveness and practicality. It is a bit quirky in some respects, but it allows metaprogramming to a very high degree and presents an extremely malleable yet still very easy to read way of doing things. Its built-in libraries for creating retained mode GUIs make it one of the easiest ways to create utility GUIs, though its performance is probably not great for the low level parts of game and media tool applications. Nonetheless, Tcl can bind to C code or use foreign function interfacing and thus obtain higher performance that way. Tcl can also be used as a macro or preprocessor language for generating code in basically any other programming language very easily and expressively, making it trivial to have full macro support in any other language if you know Tcl (e.g. just try using `subst -nobackslashes -nocommands {your language's code here}` to be able to substitute any text you generate in Tcl/Tk into the body of the language used in the code body, thus in effect enabling macros in any language). The Tcl language was dormant for over a decade, but in the recent couple of years has become actively developed again with the release of Tcl 9. It is an amazing language!
- Racket: If you asked me what the cleanest and most beautiful programming language I've ever seen or used is, then it would be Racket. No other language I've ever encountered so consistently chooses to both design and name things in such a consistent and conceptually ingenious way and with such crystalline purity. Racket allows you to create your own domain specific languages or full programming languages by building such up from Racket's provided language building constructs. The provided cross-platform IDE ("DrRacket") and REPL is also the best "desktop calculator" I've ever encountered and has built-in support for infinite number precision range and mixed numbers with zero loss of numeric precision whenever desired. If you want a language that feels absolutely pristine, Racket is for you. (PS: Racket is in the Scheme family of programming languages, or more broadly the Lisp/Scheme family. Common Lisp is also nice but is more "dirty", especially in terms of consistently choosing poor names for identifiers, unlike Racket which nearly always picks good names. Each has pros and cons, but Racket is prettier.)
- Factor: Do you like how pipelines work in shells (a.k.a. consoles, terminals, command prompts, etc), the way that it lets you simply ready code from left to write to see how things naturally flow from each stage of processing to the next? Well, imagine if an entire programming language was designed so that everything flowed from left to right like a pipeline. Such a language is called a concatentative programming language and Factor is probably the overall best example of that paradigm currently. The concatenative programming paradigm originated from the first language of its kind, Forth, and many other such languages have now been created, though relatively few know of them. Interestingly, concatenative programming languages are the easiest kind of language to implement a compiler or interpreter for, even easier than the Lisp/Scheme/s-expression family languages are due to having even less need for syntax! It is another very mind-expanding language!
Many of these above languages are some degree of "homoiconic", meaning that they have a uniform underlying structure that makes working with them much more expressive and uniform and empowering than languages that have more arbitrary syntactical structures and semantics. The performance of these languages is often worse than more popular and more systems-oriented languages though, admittedly, but to a decent extent this is not for inherent reasons in principle.
Also, here are some other languages that are more conventional (less conceptually elegant) but nonetheless notable that I like some aspects of:
- Jinx: Having mixfix syntax means that a programming languages supports expressions that are formed with arbitrary phrases instead of just rigid math-like function notation, unlike most programming languages. Jinx is such a language. It is an embedded scripting language for C++ which enables you to define phrases instead of just functions and thereby enables you to write code that actually reads like how you would say how to do something in English. COBOL gave mixfix a bad reputation, though people seem to ignore that SQL also uses mixfix notation and is extremely popular, but mixfix is great and is a very underappreciated feature!
- LDPL: Like Jinx, this is another language that supports some degree of mixfix notation. I haven't looked at it as much as Jinx, but it seems interesting.
- Mini Script: Imagine if Lua was combined with Ada in such a way that it became even simpler than Lua and shipped with a "fantasy computer" designed specifically for little game dev projects. That is Mini Script, which is an obscure language with some of the most simple and easy to learn syntax out there.
- Zig: One of the most successful of a new spate of languages that are trying to displace the venerable C programming language, Zig is designed to be easy to read and reason about by not allowing abstractions that hide what the machine will end up doing. That's a pro and a con, but some people are really into it. I personally dislike the lack of macros and other conveniences, but Zig has a great build ecosystem and provides a compelling alternative to C.
- C3: A less known alternative to C but one that more closely adheres to the spirit of C, C3 is like a "C done right" kind of high performance language. It will appeal to people who want more than what bare-bones plain C code gives you but not so much bloat as what C++ gives you.
- D: The oldest proper alternative to C++, D is essentially a re-engineering of the C++ language from scratch and has a wide variety of useful language features that are more consistent than in C++. Though D has historically squandered much of its opportunity to replace C++ through mismanagement, it is still a great alternative.
- Free Basic: QBasic and Visual Basic were once the mainstays of easily creating GUIs and games and Free Basic provides a good implementation of QBasic that allows you to create Basic code and which uses some of the same tools GCC compiled C code uses to generate its code. The language and ecosystem are aging though and in some ways are not being very actively maintained, but there is still activity and it may pick up in the future. It is a prettier C-like alternative to consider.
- Free Pascal: Having one of the best drag-and-drop "rapid application development" (RAD) GUI construction tools, known as Lazarus, Free Pascal may be more limited in terms of macros and more rigid in code format, but its performance is similar to C and it provides a in some ways cleaner and more legible way of programming than C in some respects and has a wide range of available graphical and multimedia libraries that make it still a good C alternative for game dev.
- Ada: Although Pascal is in some ways cleaner than C it could also still benefit from some cleaning up and Ada is essentially exactly that and is the oldest "safety oriented" high performance language (predating Rust by quite a long time). Its performance is very good and similar to C. Unfortunately modern versions of the compiler are essentially vendor-locked by AdaCore, though the less actively maintained FSF version of Ada does exist as an alternative. It's like "clean Pascal".
- Seed7: Another Pascal family language (like Free Pascal, Ada, and Lua), Seed7 is designed to support custom user-defined syntax, though it does so in a less elegant and less expressive way than Racket or Tcl/Tk (etc). It also is well-suited to simple 2D programming retro games, as can be seen from its demo gallery.
- Red: An open source descendant of a defunct proprietary language called REBOL, Red strives to provide an integrated package for creating complete programs including GUIs and a variety of other fun stuff (like REBOL) and has a Lisp/Scheme-like conceptual elegance but in a way that may be more friendly to conventional programmers.
- Nim: Did you ever wish that Python had similar performance as C and a cleaned up syntax and library? Well, that is what Nim is essentially.
- Julia: No language comes closer to providing such a wide range of premade mathematical functions nor enables expressing them with math Unicode characters so cleanly and in a way that so closely corresponds to the mathematical formulas and their behaviors as they exist in the research papers implement in code. Julia has a strange build system that forces the inclusion of a huge volume of dependencies in some/many cases and as such is not great for redistribution though.
- OCaml: Or, as I like to sometimes think of it, "Diet Haskell", is a highly logically structured programming language in the ML programming language family (along with Haskell, its most popular alternative) which enables many expressive language constructs and is widely used in creating compilers. In fact, the original Rust compiler was reputably built on top of OCaml until Rust later bootstrapped its compiler to be independent.
What about you?
What programming languages do you like or find inspirational/aspirational for game dev and/or other forms of programming?
Which of these languages listed above have caught your interest the most having now had them described to you?
For me, am currently learning Tcl/Tk and really enjoying that and planning on using that to create utility GUIs for whatever helper tasks I need and also as an ad-hoc website templater for personal website, among some other possibilities for larger scale tools and perhaps even a game. Tcl's performance is not ideal for real-time game dev, though usable for turn-based game dev surely and/or via FFI or binding to C for the main game processing, but it is a cool language and I'm considering it. I've also been considering the prospect of writing my own compiler and perhaps using something like Tcl/Tk for the implementation language since that is separate from the backend output and hence independent of the implementation language's performance constraints. I also think the prospect of using it as a macro or preprocessor for another more performant but less expressive language (like C or Free Pascal or Zig, etc) could also be a good approach. There are lots of good options really.
Another possibility for game dev would of course be something widely used for game dev, such as Godot or Love2D or SDL3. For many years though I've been itching to use a more expressive language or even create on of my own though, and so perhaps I will accept the performance penalty and just use one or perhaps combine something like Tcl/Tk with one of the more popular game dev frameworks (by code gen or binding) so that I can have some of the virtues of both approaches (e.g. such as using Tcl/Tk as a macro system and GUI tool system for generating C and SDL3 code or Lua and Love2D code or whatever else). I do really need to stop fruitlessly deliberating programming languages in ways that reduce my creative output and substantive life outcomes, but on the other hand I do love exploring the expressive potential of languages.
Anyway, I hope some of you find the above info interesting or useful and that it brings more of the joy of coding and creativity to your life in some way! ποΈποΈπ Edited by: WraithGlade
|