4 ms·
> no-one likes what the autoformatter does to their code, everyone likes what the autoformatter does to their coworkers' code It always strikes me as strange t
by owenmarshall 7y ago
> no-one likes what the autoformatter does to their code, everyone likes what the autoformatter does to their coworkers' code
It always strikes me as strange that we spend our own effort and time on systems that mandate code style when my unambiguously correct style and my coworkers obviously incorrect style both end up converted to the same AST for any useful work. Why isn't style an entirely local choice, with a higher-level representation of the code stored canonically?
Better question: What wheel did I point towards and suggest be reinvented?
- mintcoffee 7y agoJetBrains' MPS does exactly that - it stores the code as an AST, then renders it based on your own preferences: https://www.jetbrains.com/mps/concepts/ https://www.jetbrains.com/mps/concepts/
- gen220 7y agoWow this is a killer feature. If you're really zealous about how things "ought to be", now you can just write your preferences out once and be done with it. Stinks that it locks you into JetBrains, presumably: unless, is this part open-sourced?
- SomeOldThrow 7y agoSeems like the underlying format is unrelated to editing with customizable AST—in fact, that seems like it'd make things like code review pretty miserable. You'd have to upgrade all tooling to be ast-aware. That said, once upgraded, that would be far, far, far superior to text. Our tooling hit the limits of text a long time ago: consider how terrible diffs are at communicating simple operations like indentation changes, or how basic our refactoring is even in the best case scenarios.
- wwright 7y agoOne term for this, I believe, is “structural editors.”
- teddyh 7y agoActually, the term is “structure editor”: https://en.wikipedia.org/wiki/Structure_editor https://en.wikipedia.org/wiki/Structure_editor
- thaumasiotes 7y ago> What wheel did I point towards and suggest be reinvented? Pretty printing.