And this has caused all sorts of problems. For instance, you can make a flat text file which doesn't map correctly onto AST; this is called a syntax error. There are disputes about how the text file should be formatted (tabs or spaces?). Parsing is slow and difficult. Sometimes you misalign something; that only occurs because tokens have no boundaries.
Now consider the alternative: code is stored as a binary AST. Your editor is an interface for interacting with that AST, your compiler deserialises that AST directly into memory. An entire class of problems is eliminated. Whether your editor understands your code on an AST level is no longer a question. Yet, at the same time, the barrier to entry for writing an intelligent editor is significantly lowered. Same for writing a compiler. You get a lot more choice in terms of how you want your code formatted. Want your python code with braces, or your c code without? Done. The language itself doesn't even have braces or colons anymore. Any tool that parses code runs a lot faster. And we don't even need a new language! All we need do is define an AST format for a given pre-existing language.
I'll readily admit, my title was a bit clickbaity. There is some work on such editors. And the answer to my question is trivial: inertia. But the time has come to overcome that inertia, for the sake of all the wasted electricity and lost productivity. So here's what my post title should have been: 'Ask HN: will you help me write tomorrow's IDE?'
if you operate on AST, you still can create invalid AST, so not much of a change there.
> There are disputes about how the text file should be formatted
Solved by autoformatters.
> Parsing is slow and difficult
that's the only drawback so far
> Your editor is an interface for interacting with that AST
So now you can't use your text editor, and must use something that understand specific AST (and even specific version of that AST). Any change to that AST will require all the tools to be updated, while currently any text editor or processor can be used to edit any programming language in any version. So you just created massive problem with the tooling. Your grep, documentation generator, sed and countless other text tools just stopped working.
I can type characters much faster than I can drag a mouse, so I’m not seeing any increase in productivity. In fact, the coding part of my job is perhaps the most streamlined. It’s the design, planning, and people ops that consume the most brainpower.
That way, you can have different screen/page/workspace environments tailored to whatever it is you are working on at any given time.
The way Scratch lays out functions in graphical C-shaped objects makes it pretty much impossible to do incorrectly, and ensures your inputs are always correct. Except I'd make mind collapsible, since you don't always need to see the code itself, but the functions are always right where you want to see them.
I'd also incorporate ideas from Blender and Logic Audio's MIDI patching interface, which are sort of like dia on steroids.
It's something I've always wanted to do, but it is, at least currently, outside the perimeter of my available skill set, and I haven't bumped into a team that would be interested in creating it.
Also, the conversion of text to AST is not straightforward. What do you do with infix operators? In the AST you loose the hability to write nice math formulas. What about f'' strings in python? I'm 99% sure they are desugared, specially the new version with the = sign.