73 points · by pmoriarty · 9y ago · 25 comments
"Programs are not text; they are hierarchical compositions of computational structures and should be edited, executed, and debugged in an environment that consistently acknowledges and reinforces this viewpoint."
It is unfortunate that most major code editors and IDEs today do not store units of code (like Lisp SEXPs) as databases to be updated as you edit, which would make problems like this or other operations like metaprogramming, formal analysis, or documentation much easier to solve.
It's cool, but it has some major downsides too. For example, MPS stores the source as XML, not text (since it isn't text, it's a tree). This makes lots of basic tools we've taken for granted a lot harder, such as git merging etc. They've had to make a custom mergetool just to make basic collaborative coding feasible.
I bet there's other ways around that, all I'm saying is that text has major, major upsides because of the enormous ecosystem support.
If only there were a way to write your code using a uniform tree syntax in the first place...
Doesn't solving this just require a text-to-AST, AST-to-text input and output step?
Anyplace outside the editor the programmer just sees regular text.
Text is probably the next biggest mistake in programmer productivity after null.
It would finally settle the formatting arguments and all the tooling would be able to leverage each others projects.
Even PHP has an internal AST representation these days.
Having taken Teitelbaum's compiler class as an undergrad, I was happy to ditch the IDE he inflicted on us and go back to text editors. Structured code editing is a tricky UI problem and I didn't find a really good IDE until many years later.
There's no one way to edit code. Sometimes refactoring tools work well, but typing text can be quite efficient too. Getting locked into a tree editor at the expression level is no fun.
If they are they either aren't offering user/programmer access to that database, they aren't doing semantic/type binds, or aren't advertising those features well.
>I was happy to ditch the IDE he inflicted on us and go back to text editors. Structured code editing is a tricky UI problem
It's reconcilable with normal text editing, just update the structure once its valid. I agree that things like block/visual programming can be absurd.
But this indexing is only on one user's workstation and tends not to scale up well. Updating dependencies or switching to a different branch means rebuilding large parts of the index.
Also, part of the problem is that there is little standardization. Many ecosystems are language, platform, build tool, and/or editor-specific. When you do something new you end up reinventing the wheel.
[0] The Cornell Program Synthesizer: A Syntax Directed Programming Environment https://core.ac.uk/download/pdf/21750999.pdf?repositoryId=14...
https://help.github.com/articles/searching-code/#considerati...