Writing intro article on hex
Fabio Cevasco h3rald@h3rald.com
Tue, 17 Dec 2024 06:24:21 +0100
1 files changed,
64 insertions(+),
0 deletions(-)
jump to
M
contents/articles/hex.md
→
contents/articles/hex.md
@@ -7,3 +7,67 @@ content-type: article
timestamp: 1734263361 ----- +I have a page on my personal wiki system (which is written in [min](/min) with a [h3](/h3) frontend, and *still* closed-source) titled _Use cases for a new programming language_. The first line I wrote is the following: + +> A new programming language should only be created if it helps addressing a specific, practical use case + +Right. That was meant to dissuade me to embark in endless quests for creating yet another (pointless?) little language that _probably_ doesn't really solve any practical purpose. I have a bunch of those lying around or even half-designed in my personal wiki, and of course [min](https://min-lang.org) has been my go-to personal project for many years, and I still enjoy tinkering with it. + +But... + +I still wanted to create a new language. The problem with min is that by emphasizing practicality more and more, it became more of a single-file, batteries included programming language that can be used to create web servers, make HTTPS requests, process XML files, ...things like that. + +The syntax also evolved quite a bit to support complex data types, it has sigils and other oddities (bang-postfixed auto-popping symbols, anyone?). And it is also not that small anymore. Well over 1MB on some platforms. It statically links OpenSSL for Heaven's sake. + +And it is written in Nim. Because I forgot how to program in C. Sometimes I wish I invested the same amount of time in re-learning C rather than picking a new slightly non-mainstream language to build my ecosystem with. But it's fine, these are not regrets, everything helps shaping up the future, in life. + +### Why _hex_? + +I wanted to create a language that was: + +- Really minimalist in syntax +- Small in size +- Cross-platform (compiling to WebAssembly and also [αcτµαlly pδrταblε εxεcµταblε](https://justine.lol/ape.html)) +- Was implemented in C (that was more of a personal thing than anything else, but C ain't going anywhere as a language, at least) +- Concatenative (I am still fascinated by the concatenative programming paradigm) +- Able to do basic operations on strings and numbers, and delegate everything else to external programs +- Able to be used to create shell scripts, used as glue code, etc. +- It had some quirks. Not many, but _some_ to make it interesting and fun to play with +- Be easy to learn and useful to learn more about concatenative programming + +Then the name. It took me hours of thinking over... weeks to come up with a good name. I then settled with _hex_ because: + +- It's short and memorable +- It has not been used for another programming language yet (go try find 1-3 letter words that are not, you'd be surprised) +- It has something magical about it (besides thinking about hexadecimal numbers, it also means _spell_ or a curse) + +### MVPL (Minimum Viable Programming Language) + +Another page of my personal wiki aims at defining what constitutes a _minimum viable programming language_. + +Here's a list of things that I consider _mandatory_: + +v integers +v strings +v arrays +v exec external processes +v variables +v define functions +v flow control: conditionals, loops +v error handling +v file management +v std io + +...and here's a list of things that are _nice to have_: + +? floats +? objects +? booleans +? lexical scoping +? serialization/deserialization +? regex +? networking +? xml +? json + +