This is still the header! Main site

TempleOS: 70% Lisp Machine

2021/08/29
This is post no. 29 for Kev Quirk's #100DaysToOffload challenge. The point is to write many things, not to write good ones. Please adjust quality expectations accordingly :)

You might have heard about Terry A. Davis, his battle with mental illness, and how he had spent more than a decade of his life writing an entire operating system dedicated as a temple to God. There might have been mentions of 640x480 and 16 colors (chosen by God Himself)... or glowing-in-dark CIA agents following him. Sadly, he passed away in 2018; it is not a happy story, but it has the interesting side note that he has, despite his illness, managed to produce a working operating system... which is no small feat for anyone.

You might end up assuming that the only interesting thing about TempleOS is its unusual backstory; after all, many small operating system projects exist, and only a few of them get far ahead to do anything interesting.

This is where I was coming from when I encountered an article titled A Constructive Look at TempleOS (... from 2015, apparently). Which upgraded my expectations enough that I ended up downloading the ISO and trying it out. (It's a one-liner with qemu.)

Well, as it turns out, this thing is about 70% of the way towards a freakin' Lisp OS in terms of power. Also... why aren't we using this in university operating system courses?

First impressions

So... you get a bunch of terminal windows when you boot it up. Key bindings are weird. Esc to quit things, but then it doesn't really close windows? And sometimes it's Shift-Esc? And, of course, there is the 80s style aesthetic. And OMG all the blinking things are distracting. (Don't worry, your brain will get used to it fairly quickly.)

However, unlike many random test operating systems, you're not left around trying to figure out how things work. There is a tour you can go through. Also, it has a help system. And the help system is very good. More about that later.

Plus, there are things to play around with. There are games. There is stuff to read. But... playing around with the entire thing is really fun, too; trying to figure out how things work.

Because things really do not work the way you'd expect operating systems to work.

Where did I hear this before?

... but Lisp Machines?

It's not even Lisp; what are we talking about?

Well, the programming language is called HolyC; it's just... a fancier version of C? With, e.g. default parameters. And other changes that often make a lot of sense once you forget about the preconception of "but you shouldn't try changing C". As in... you can write inline assembly in the middle of a function without even quoting it, with string literals definted in the middle of it, and it somehow works. But that's not the coolest part.

The coolest part is that the entire OS is made out of this. Kernel code is written in it. Apps are written in it. And the command line works by insta-JIT-ing HolyC, line by line, and running it.

Well, actually, everything works by insta-JIT-ing HolyC. Including the kernel. At every boot. Which takes a grand total of... 2 seconds?

It's not as dynamic as a Lisp image; it's still a version of C, so you can't quite rewrite the kernel as it's running; you need a restart for that. Which takes, well, 2 seconds.

I haven't actually seen any other (recent) OS that's this easy to modify. There are no black box parts. There is no complex toolchain. You just edit files. And modifiability is important.

This is, by the way, why UNIX (which is kind of its own programming language) is cooler than OSes that are made purely out of pre-compiled C/C++ (e.g., say, Windows). They're still a weird hybrid, made out of shell scripts and pre-compiled C blobs; TempleOS proves that you can write a purely C-based OS with a simliar flexibility; you don't even have to choose a Lisp as your One Programming Language.

Documentation

Lisp Machines had presentations. Things that you could see on the screen would still directly correspond to the objects they represented, so by clicking on them you could inspect them or use them later. Which made figuring out how things worked a whole lot easier.

Yet again, TempleOS is not quite there. It's C, which doesn't quite have the amount of introspection capability to inspect all memory ever. But... it feels a lot more powerful than it sounds like.

It's not just that TempleOS has its own hypertext format, with formatting, links, etc. It's that it's everywhere. Terminal output is made out of this, too. The file explorer is basically like ls, except the outputs are all clickable and look like a tree (yes, trees are a builtin thing in the hypertext format). You get a stack trace? It's clickable and will open the relevant source files for you. Ohh also, the source files can also include the same kind of hypertext.

As a result, you can just look around the entire system, without resorting to people on the internet telling you how things work. Which is a whole lot more fun than the usual "go through 5 forum posts until the 6th actually works" version.

... so...

... it's been only a day since I started playing around with TempleOS, and I haven't even mentioned many of the fancy things yet. Overall though... it's an artifact that's awesome and yet more refreshingly alien than any of the UNIX or Windows clones (... doesn't even Windows have /etc/hosts somewhere?)

Definitely recommended for anyone interested in operating systems to some degree.

... comments welcome, either in email or on the (eventual) Mastodon post on Fosstodon.