Principia Softwarica

77 points by runxiyu 19 days ago on lobsters | 43 comments

The title is clearly a reference to ‘Principia Mathematica,’ but ‘softwarica’ is not Latin. It’s like someone writing a purportedly C function call as foo(bar; baz]. A better title might be ‘Principia Programmatum’ (The Principles of Programs) or ‘Principia Artis Programmatoriae’ (The Principles of the Art of Programming).

I can't stop reading this as "Principia Costa Rica".

If we want to be pedantic, "Programmatum" does not exist either. The closest would be "Programmum" but it means "proclamation, edict", not program. There isn't any word in Latin to describe software or programming so it's fine to invent a new one.

It's true that "Programmum"/"Programmatum" sounds more correct because it's derived from the English "program" which is itself derived from French "programme", itself from Latin "programmum". But we can take one step closer to the original and use the French word "logiciel" ("programme" is also a valid word for software in French, but this meaning comes from English), which comes from "logique" (logic) + "iel" from "matériel" (hardware / made of matter).

So, as "logique" comes from "logica" and "matériel" from "materialis" and the noun form of "materialis" is "materia" (matter), we could translate "program" to "logicia" and "programs" to "logicium".

(disclaimer: I don't really know Latin, only studied it for two year in high school)

sinic | 18 days ago

If we want to be pedantic,

Libenter :)

There is no word "programmum" in Latin: "programma" is attested in Late Latin as a loan from the Greek "πρόγραμμα", and its genitive plural is then indeed "programmatum". Its use with the meaning "computer program" is reportedly attested in the Vox Latina journal (and also on Vicipaedia, for what it's worth).

Comment removed by author

madhadron | 19 days ago

I thought butchering the Latin was kind of the point. It's a dead language, and a title referencing a well known failed project. Titling any English language work in proper Latin today would be mildly ridiculous, and that's coming from someone who used to read Latin quite fluently.

groctel | 18 days ago

But Latin is not a dead language, though. Citing Wikipedia:

While often called a "dead language", Latin did not undergo language death. Between the 6th and 9th centuries, natural language change in the vernacular Latin of different regions evolved into distinct Romance languages. After the fall of the Western Roman Empire, Latin remained the common language of international communication, science, scholarship and academia in Europe into the early 19th century, by which time modern languages had supplanted it in common academic and political usage.

Also, a language being dead does not mean that there's no people who care about speaking it correctly or that it's free for all to butcher. Someone's gotta maintain that legacy grammar ;-)

Latin is not a dead language

My grandfather told me a story about hitchhiking in continental europe between the wars. He was in a youth hostel one morning, and tried to strike up a conversation with another young man while they were shaving in the bathroom. They found the only language they had in common was latin!

My grandfather read classics at Oxford, so he was more likely to reach for the language than most people. (And he wouldn’t have told the story if it had been a common occurrence!) Even so, basic latin was a mandatory requirement for every student at Oxford and Cambridge and I expect many other universities right through the 1960s.

But since the 1960s the number of people in Britain who are routinely taught latin to secondary school standard has declined dramatically.

It’s still used for ceremonial purposes in places like Oxford and Cambridge. (For instance Cambridge University has an annual ceremony once a year for which a classics professor has to write an oration in latin, which is apparently witty if you know the lingo.) And latin is the official language of the Roman Catholic church, so it’s living enough to be the national language of a weird microstate.

But 90ish years after my grandfather’s unlikely story, there’s no chance that two gap year students meeting in a youth hostel might both know more latin than “eheu! caecilius est in horto!”

vrthra | 18 days ago

While often called a "dead language", Latin did not undergo language death.

I think linguists did the world a disservice by calling languages dead and alive. I wish they had used neutral words like crystallized and liquid or amorphous instead. Languages such as Latin are not dead. They continue to be used, though evolution has stopped.

koala | 18 days ago

Dipping in Wikipedia, although I was a bit confused by different articles on Neo-Latin and Contemporary Latin... I found what I was looking for: Lexicon Recentis Latinitatis. Because some guys still publish new documents about the current world in Latin, someone has to come up with new words for Latin.

So likely Latin is evolving so slowly that you could call it a dead language, but it does evolve. (Edit: to continue the analogies... it's likely on a very LTS state, with someone still pushing very small updates.)

fpsvogel | 19 days ago

Principia Programmatica?

sic transit status machinae

nrvous | 19 days ago

Initially I balked at the mention of Plan 9, but the detailed explanation of why the author chose Plan 9 (TLDR: it's small) is a great piece of writing – in itself an excellent advertisement for the books!

marcecoll | 19 days ago

Why did you balk at the plan 9 mention? Just curious

nrvous | 19 days ago

Only because I have no Plan 9 experience, and I'm so time-poor that I instinctively flinch at the prospect of having a Whole New Thing to learn about! I (sadly!) don't actually have time to read these books right now, irrespective of the OS in question, so it was just a reflexive reaction rather than something more thought out.

taras | 19 days ago

I love how author ported OCaml to plan 9 and then rewrote large parts of userspace in OCaml and to better understand what happens in C.

In process the code also became runnable on Windows of all things :)

Curious who funds this.

edwintorok | 18 days ago

Interesting that a very old version of OCaml was used (1.07): https://aryx.github.io/xix/#about

Fingel | 19 days ago

This is an insane undertaking. 17 books over 6k+ pages. All seem to have been released last week?

Does anyone have any additional context or background on the author?

linschn | 19 days ago

See this 9fans thread

https://www.mail-archive.com/9fans@9fans.net/msg45156.html

TL;DR: it started in 2014 and the author is going to present his work at IWP9 tomorrow 13:45 local (Victoria, BC, Canada) time: http://iwp9.org/#prg

Fingel | 19 days ago

Thank you, this is exactly what I was hoping for.

There is a bit of drama in the thread in regards to AI usage:

yes I started to use Claude Code in March this year to assist in writing. I started this project though in 2014 and spent almost 6 years full time on it since 2014 decomposing every programs in many parts and books.

Worth reading the thread before committing to reading the books, I think.

pekkavaa | 19 days ago

I can't help but think that a couple shorter books would've been more useful to readers. I'm sure the author has learned a ton during the process, however.

[OP] runxiyu | 19 days ago

Principia Softwarica is a series of books explaining how things work in a computer by describing with full details all the source code of all the essential programs used by a programmer. Among those essential programs are the kernel, the shell, the windowing system, the compiler, the linker, the editor, or the debugger. Each program will be covered by a separate book.

The operating system they target appears to be Plan 9

lproven | 19 days ago

The operating system they target appears to be Plan 9

This is a very poor, inaccurate summary; did you actually read the page?

« Learn Here, Apply Everywhere

You do not need to use Plan 9. Understanding one small elegant OS gives deep intuition about Linux, macOS, and even Windows. »

[OP] runxiyu | 19 days ago

I definitely do understand that, although I should have rephrased it as s/target Plan 9/use Plan 9 as the primary example/.

It does mean the codebase is marginally more familiar to me than the other OSes though.

windows actually has a 9P implementation in it

it's used for the WSL2<->windows filesystem bridge. i wish it was exposed more generally as a FUSE-like thing (but from what i can tell, it's slower than SMB)

dzwdz | 18 days ago

but from what i can tell, it's slower than SMB

A few years ago I tried to use rsync inside of WSL to copy a lot of data (I don't really want to guess how much), and the ETA was well over a day. I snooped around, and saw some people say that the 9P bridge is slow - so I tried out the native rsync build. It finished in less than an hour.

vetch | 19 days ago

Yet in the very first paragraph it states:

All the programs come from Plan 9 from Bell Labs,

So it appears that OP is correct. OP didn’t claim that it wasn’t transferable to other systems.

lproven | 19 days ago

No, it is not correct. It specifically says, at some length, that the lessons are intended for users of all OSes but especially the C/Unix family of OSes, and spells out very clearly and explicitly that it uses Plan 9 because the code is exceptionally small, concise and clean.

It does not target Plan 9.

It explains Linux, FreeBSD, and all other Unix-like OSes using Plan 9 as its tutorial example. It is not "targetting" Plan 9. It is targetting people, and explaining Unix and C concepts using Plan 9 because the entire OS is half the size of Vim.

Saying it "targets Plan 9" is actively misleading.

kevinc | 19 days ago

The issue was mere word choice. Your opposite accusations (not having read it vs. being manipulative) are kinda over the top.

lproven | 18 days ago

As you wish. I am used to being downvoted. I think it was a vital clarification, and I do not really care if lots of people disagree with that.

Shockingly, a lot of the world runs on incorrect and fallacious beliefs, and you get shouted at when you point out that they are wrong. They remain wrong, however angry they make people.

darth-cheney | 18 days ago

Seems like a big deal to me!

eterps | 18 days ago

Project Oberon (Wirth & Gutknecht) is the closest in spirit to Principia: [...] However, Oberon can only run Oberon programs

While I understand what the author means here, this is IMO not a restriction of the Oberon system; in principle, any programming language can target its architecture and runtime.

vrthra | 18 days ago

I see that it was forked from Plan 9, but between Plan 9 and Inferno, which is better?

lproven | 18 days ago

I see that it was forked from Plan 9

No, it was not "forked from", as far as I can see. It uses Plan 9 as an example, and it works through its examples.

It also clearly explains why Plan 9. The most relevant part of the answer to your question being that Plan 9 is written in C. A highly restrictive form of C, at that.

Inferno is not written in C. The point of Inferno is that it is written in an architecture-neutral language that runs on a VM that is part of the kernel.

That language is Limbo.

(In fact, since Inferno didn't catch on, that language is more or less the only one that targets that VM.)

Because Inferno didn't catch on, Limbo did not catch on. That means that few people know Limbo, whereas a lot of people know C. This also means that there are very few reference materials for Inferno, while there are absolutely loads for C, in more or less every human language from every society that uses computers.

So, for this pedagogical purpose, Plan 9 is better than C: because of the world's familiarity with the language Plan 9 is written in.

r31r06 | 18 days ago

Agree to what you say on Plan 9 and Inferno. However the code in this book(s) is a fork of Plan 9. The first slide says so: "A New Plan 9 Fork".

lproven | 18 days ago

I am mystified. What slide? I see no slides or presentation. It's a book, or rather, a series of books.

« Principia Softwarica is a series of books explaining how things work in a computer by describing with full details all the source code of all the essential programs used by a programmer. »

These are literally the first lines on the page, excluding titles and links.

r31r06 | 18 days ago

Sorry, forgot to post the link: https://aryx.github.io/assets/pdfs/slides.pdf

Search "presentation slides" in the page.

regulator | 19 days ago

Very cool, thanks for the share.

Wow, this looks very ambitious. I believe reading good code -- especially with explanations for design choices -- makes one a better programmer. Maybe particularly if that code is for a domain just outside one's own. This should be a great tool for learning.

MarkMLl | 18 days ago

So what are the advantages of basing this on Plan 9 rather than on (as a specific example) Minix, the architecture of which is validated by the /substantial/ number of systems on which it is installed?

lproven | 18 days ago

I can think of several.

  • Plan 9 is arguably a lot more complete. Minix 3 is not.
  • Plan 9 is tiny and conceptually entire: it contains its own toolchain. It's therefore pure. Minix 3 imported a lot of the userspace of NetBSD and much of that does not work yet.
  • Plan 9 is capable of SMP and 64-bit and so on; Minix 3 is not. I am not sure that's relevant.

Also, a monolithic kernel like plan9 is perhaps more useful as a teaching tool in that it’s more like Linux, Darwin and NT. (Very large brush, don’t fight me please.)

That said, I would still be very interested in learning about a microkernel with the same pedagogic method as this.

lproven | 18 days ago

Also a valid point, I think, although I'd be interested in @markmll's response.

r31r06 | 18 days ago

  • Plan 9 was supposed to be the "next Unix", made by some of the Unix creators and the intention of the project was to improve on Unix. To remove as many of contradictions, to push the principle of being simple and elegant, require less code, add network abstraction from the start (Unix did not have networking as an initial part of the design).
  • It is not just kernel code, but Plan 9 C compiler, Assemblers, user programs like the shell, and graphical user interface

So it's not just the OS, its a lot more. The slides show that basing it on Linux would many many many times more. I don't know how much lines in comparison it would be to base it on Minix though