Comment by jacobr
3 days ago
Could the next-gen version control system just store ASTs? Does this already exist?
Every user gets their own preferred formatting, and linters and tools could operate on already-parsed trees
3 days ago
Could the next-gen version control system just store ASTs? Does this already exist?
Every user gets their own preferred formatting, and linters and tools could operate on already-parsed trees
The Unison programming language is built around that idea: https://www.unison-lang.org/docs/the-big-idea/
BABLR is building that! It's entirely fair to say that BABLR takes Unison's approach and allows it to be used with every programming language.
This is an idea that comes back often, and has merit of course.
The thing is that this means sacrificing the enormous advantage of plaintext, which is that it is enormously interoperable: we use a huge quantity of text-based tools to work with source code, including non-code-specific ones (grep, sed…)
Also, code is meant to be read by humans: things like alignement and line returns really do matter (although opinions often differ about the “right” way)
And of course the lesser (?) problem of invalid ASTs.
I don't think invalid ASTs are a "lesser" problem, it is a pretty big one: we want to be able to source control work in progress and partially complete things. There's a lot of reasons you might not want to or be able to finish a bit of code and yet you still want to record what you've done and where you are (to pick it back up later, to get other developers' eyes on a sketch or an outline, to save it to backup systems, etc). Those are often important steps in development, though it is easy to forget about how common they are when you think about software as finished/buildable artifacts only.
I know a lot of people think source control should only have buildable code, but that's what CI processes are for and people use source control (and diffs) for a lot of things that don't need to pass CI 100% of the time.
I don't understand why it can't just use an AST if it parses, and fall back to plain text diffs if it doesn't.
1 reply →
These are all solvable problems, and I know because I have built a solution the demonstrates how they can all be solved at the same time.
you might want to check out eyg lang (eat your greens) as I think the idea is explicitly that syntax is user preferences and the ast is the _real_ language
Isn't this one of the basic ideas of Lisp?