What's wrong with text code?

Oh boy, where do I even start...

There are so many ways in which coding as we know it is broken. Discipline, reuse, knowledge transfer - to name a few, but instead of focusing on these, (we'll get to them eventually) I'll simply open the line with my best argument: how it fails to preserve the programmer's intent.

What is the purpose of code?

There's very little disagreement about this one: to tell the computer what to do.

But that's not all there is to it, now, is it? Of course it has to communicate intent to the computer, but it must also communicate intent to the next human working on that piece of code.

So... to translate and preserve intent. That's the purpose of code. But when we take a closer look at the programming languages we use, we find that none of them were actually designed to tackle the "preserve" part.

But, but, but... comments!

Well... You can pour ketchup on a pizza, but it's not part of the recipe and arguably does more harm than good. It's the same way with comments, especially in the context of preserving intent. Even if we pretended for a moment that comments don't go stale, which of course they always do, there's still a problem, and a much, much bigger one at that, specific to preserving intent in comments.

Drumroll please,

Comments don't carry over with composition.

Read that one again. Because that's. what's. wrong. with. text. code. The most eloquent explanation of what a function is for is lost on the function that invokes it. The purpose of that return value two calls down the stack? Gone.

Could this be fixed?

Maybe. But not without incorporating the preservation of intent into the language. You know, the part that the compiler doesn't completely ignore. As to how, I can think of a few options but they're no more than unbaked ideas at this point.

It's worth mentioning, there are notable examples of previous attempts, like Charles Simonyi's intentional programming, which is - TADA! - more like a database than text. Which brings us to the question:

Could this be fixed within the realm of text code?

Nope. Not a chance. Because even if there was a way to fix this on a language level, it would just make what's already complicated, more complicated. See, the moment you manage to side-step the "intent" land mine, you step on another one: discipline.

But that's for next time.

- It's all in the connections