This is the way. Programs are not text, there's an impedance mismatch that shows at the seams.
There're good reasons it hasn't been done more: text is good for troubleshooting, "every program should do one thing well" and maybe preventing lock-in.
But with programming tools reaching maturity, we'll see more of this. Also there's an AI-related aspect: bots can understand structure just fine.
There are good reasons it hasn't been done more, and I don't think it is just "text is good for troubleshooting."
At large, text wins because the job of a program text is to communicate the program to a user in a way that a computer can also be made to use. Things that help include that text can have multiple interpretations and meanings. This is why most variable names are nouns. You can literally "ascii art" parts of code to help convey some ideas.
The most important part of why "text" wins, though, is that it is all visible. Yes it implies some structure underneath that the computer is going to need. The text, though, is fully visible to users. People think they want the ability to "structurally edit," and you can sometimes make that work rather nicely. Most of the time, though, you are working with structures that are not complete. And worse, completing them will not be a process that goes in the same direction as the text. You will have to start a stack in how you are processing things to complete as you go.
I'm torn on the bots comment, as I just don't know. LLMs, arguably, are leaning in on the structure that has been embedded in our symbolic text over many years. The same structure has not necessarily been developed in computer programming texts?
(Also worth paying attention to how most of these goals were pursued with symbolic programming techniques back in the day. LISP, of course, but also term rewriting techniques that used to be rather magical.)
> Most of the time, though, you are working with structures that are not complete. And worse, completing them will not be a process that goes in the same direction as the text. You will have to start a stack in how you are processing things to complete as you go.
This is very insightful. A program that is being edited passes through all sorts of incomplete states. Non-structured editors will let you do things like paste mismatched braces .. which sometimes you definitely deliberately want to do!
Edit: someone else makes this point at greater length https://news.ycombinator.com/item?id=42612969
> But with programming tools reaching maturity, we'll see more of this.
Programming languages reached maturity 31 years ago, with the approval of X3.226-1994, which specified a language which is at once textual and structured, and easily amenable to structured editing:
The first commit to paredit was 17 years ago: https://paredit.org/cgit/paredit/commit/?id=8be6d99412d0d4a3...(defun square (x) (* x x))
Structured editing was being performed on teletypes almost 60 years ago: https://en.wikipedia.org/wiki/Interlisp
The future is here; it’s just not evenly distributed.
In my opinion, that’s the magic of programming languages. I type a few high level words and characters, then there is a deep stack of interpreting the strings into machine code and returning data and side effects. It is stupid simple as the end user and immensely complex chain of machinery.
SQL is an extreme example of strings parsed to make complex computer behavior. Shell scripting too.
For enforcing complete object correctness and interfaces as they are explicitly designed then low code no code seems like it has a better proposition.
Anyway, maybe structured editors fit a space between dumb strings and pointing and clicking blocks and connectors. I’m all for correct tool for the job and end user. I think that minimizing end user tooling with some LSP go-to definitions and linting in a text editor is my preference. Similar to how FIFA used to be against high tech slow mo replay for soccer matches to make the sport egalitarian / accessible for the whole world I think that analogously programming should focus on the simplicity and portability of authored documents.
It's fascinating because I came to a similar conclusion while working with very old IBM mainframe code editors (AS400 / IBM i "Source Entry Utility")
It's nearly impossible (if you read the docs) to write something with bad syntax on those machines. Columns are semantic in most of the languages (COBOL, RPG, DDL). When you write a program, if you don't know what you're doing, you can press "F4" and it will show you what each column means and when/how to use it [0]. It's not exactly a structured code editor, but it shares some similar concepts (see the link; you often write code in a "prompt" at the bottom of the screen, and the line won't insert until it's complete, though you can write it by hand if you wish).
All of that said, IBM's old SEU is still vastly inferior to modern text editors and IDEs, mostly because of the limited view window and the lack of syntax highlighting / basic modern features [1].
I think that, especially for enterprise code/development, there are some benefits to structured editing that are worth exploring. Not having a linter shout at a partially-complete line because you paused for a second or two would be nice, as well.
[0]: https://youtu.be/iw_wk5elf3Q?si=m9zVeboTyw0T8_Wu&t=635 [1]: https://youtu.be/Q3hxwcYB1Oo?si=WE9-rFdYo72A5yXz&t=404
Hell, even text is not exactly text, it also has structure. I'd love to have refactoring tools for prose.
> Programs are not text
Wow. It's amazing to see the beast laid out so clearly before me.
As someone who grew with the mantra "a program is a piece of text", my jaw dropped when I read this post and realized that it was not written in jest. Of course the mantra is still deeply entrenched in my mind, it's too late to remove it now; but I feel as if the world is crumbling around me. What other sacred beliefs will fall? Why doesn't everybody realize that the text file is one of the finest inventions of the third millennium?
Maybe it's just another period in the eternal cycle of fashion trends... programs as free-form text files were an exhilarating liberation from the crufty, fixed-form structures of older languages. Now, we are not only going back to write our code starting at column 4 (like in punched cards), but we still want to add even more structure to it! Maybe in forty years we will go back to free-form text and cherish it again.
Reading the sentence "programs are not text" was the first time I felt old in my life.
Programs weren’t free-form text at any time in history (esoteric languages aside). There is still structure, it’s just enforced by the compiler (and maybe linter).
TBH, I think you are reading too much into it.
For me, json files are also just text files. Or ini files. Or md files.
They do, however, prescribe some structure, or syntax, in them, to be parseable by the interpreter/compiler/whatever. I think this has always been the case.
Are you aware of Lisp? In Lisp programs were never "text". They are written directly as trees which are evaluated as part of the program execution. The trees themselves can be written via text, e.g. using s-expressions which are a tiny minimal way to represent trees as text, but they could also be generated via code (called macros) or written in some other way entirely. This is fundamental to understanding Lisp and one of the reasons "programs are text" people are often put off at first.
Then there are languages like lisp. If you ask anyone in the community who's drank the s-expression koolaid, they'll say "your editor will take care of it bro, 12 closing parenthesis are totally fine". But every once in a while you're stuck in an environment with barebone vim, you mess up some editing, the language provides completely unhelpful error messages, and you're stuck debugging a bloody syntax error for 30 minutes.
The command line interface of a language should be really good and one should be able to program without any fancy tooling. The compiler shouldn't offload any responsibility to the editor/lsp.
Yes, this is true. At this point, I would lean to that and panic. But it's also true that one can have already setup their editor to the REPL of an environment, obviating the need for using other editors and still retaining the type of control one would have in their editor.