4 ms·
> why does it make more sense to use asts here For one, it eliminates a class of merge conflict that arises strictly from text formatting. I always liked the
by ibejoeb 7mo ago
> why does it make more sense to use asts here
For one, it eliminates a class of merge conflict that arises strictly from text formatting.
I always liked the idea of storing code in abstraction, especially editors supported edit-time formatting. I enjoy working on other people's code, but I don't think anybody likes the tedium of complying with style guides, especially ones that are enforced at the SCM level, which adds friction to creating even local, temporary revisions. This kind of thing would obviate that. That's why I also appreciate strict and deterministic systems like rustfmt. Unison goes a little further, which is neat but I think they're struggling getting adoption because of that, even though I'm pretty sure they've got some better tooling for working outside the whole ecosystem. These decoupled tools are probably a good way to go.
I was messing around with a file-less paradigm that would present a source tree in arbitrary ways, like just showing a individual functions, so you have the things you're working on co-located rather than switching between files. Kind of like the old VB IDE.
- psadri 7mo agoRelated, I’d love an editor that’d let me view/edit identifier names in snake_case and save them as camelCase on disk. If anyone knows of such a thing - please let me know!
- ibejoeb 7mo agoSure. Presumably you could have localized source presentation, too. But, yeah, I think a personalized development environment with all of your preferences preserved and that don't interfere with whatever the upstream standard is would be a nice upgrade.
- Wilfred 7mo agoThis is actually possible with glasses-mode in Emacs: https://codelearn.me/2025/02/24/emacs-glasses-mode.html https://codelearn.me/2025/02/24/emacs-glasses-mode.html I think it sees very little usage though.
- micw 7mo agoAn AST based conflict resolver could eliminate the same kind of merge conflicts on a text based RCS
- ibejoeb 7mo agoYeah I suppose that's true, too. You've got to do the conversion at some point. I don't know that you get any benefit of doing storing the text, doing the transformation to support whatever ops (deconflicting, etc.) and then transforming back to text again vs just storing it in the intermediate format. Ideally, this would all be transparent to the user anyway.
- gritzko 7mo agoFor one merge, yes. The fun starts when you have a sequence of merges. CRDTs put ids on tokens, so things are a bit more deterministic. Imagine a variable rename or a whitespace change; it messes text diffing completely.
- hosh 7mo agoI remember someone mentioning a system that operated with ASTs like this in the 70s or 80s. One of the affordances is that the source base did not require a linter. Everyone reading the code can have it formatted the way they like, and it would all still work with other people’s code.
- skybrian 7mo agoIt seems like that could be done in the editor if you auto-reformat on load and save. (Assuming there's an agreed-on canonical format.)
- deleted 7mo ago[deleted]
- hosh 7mo agoThe point is that in an AST based storage, the AST itself is the source of truth. Therefore, there is no canonical format.