5 ms·
That's assuming the code-base was still saved as a representation rather than a syntax tree that can be viewed in whatever way a given developer prefer. There's
by mkohlmyr 11y ago
That's assuming the code-base was still saved as a representation rather than a syntax tree that can be viewed in whatever way a given developer prefer. There's no reason that has to be the case. In fact intuitively i'd be inclined to say its probably easier to write a VCS for a syntax tree than a free text string?
- qznc 11y agoThe modern/popular way is to run a format tool before you commit. (gofmt, clang-format, etc) A VCS for syntax trees means you need the One True Data Format(tm) for syntax trees in any language. Finding consensus on formatting per project is easier than unifying all syntax tree representations globally.
- WorldMaker 11y agoAdditionally, there are many reasons you might want to commit work in progress code that doesn't/won't parse correctly to a "proper" syntax tree. While there are certainly workarounds (pseudo-trees for "malformed"/"unfinished" sections), there's entire neighborhoods of bikesheds to paint there. (Amongst the major compilers thus far the only ones I've seen invest useful time in mostly unified intermediate syntax trees is the Roslyn compilers for C#/VB, often compilers don't care but Roslyn had the opportunity/drive/interest to try to merge a lot of editor support directly into the compiler infrastructure.) (Aside: I built a cool proof of concept for what I think is the most useful "smart middle ground" here, which is to use syntax highlighting lexers (tokenizers) for a useful effect in creating smart character-based diffs. Syntax highlighting lexers are designed for intermediate code and with output as ordinary character diffs you don't have to bikeshed a universal token stream format. The tokenized diffs were cleaner and faster than the equivalent non-tokenized character diff. https://github.com/WorldMaker/tokdiff https://github.com/WorldMaker/tokdiff if anyone wants to play with it.)
- Sujan 11y agoLast time I checked my codebases were all plain text files. But yes, having a syntax tree would solve this problem quite nicely. (But to make it work universally you have to decide on a representation of this syntax tree to be able to represent it in plain text files to make it work with all the editors and IDEs that don't support that syntax tree stuff... And then we're back to .editorconfig, aren't we?)
- michaelmior 11y agoPerforming merges and handling conflicts seems like a harder problem than for text.
- e12e 11y agoThe two examples I can think of is ColorForth[1] (not sure what the representation is there, or how/if one would couple it with a (D)VCS), and of course Smalltak with it's DVCS Monticello: http://news.squeak.org/2008/08/15/all-new-monticello-2/ http://news.squeak.org/2008/08/15/all-new-monticello-2/ I had no idea there was such a new rewrite (2008), but then I keep forgetting that DVCS are rather new (as in popular, free-software DVCS are pretty new - git is just over 10 years). [1] http://www.colorforth.com/cf.htm http://www.colorforth.com/cf.htm [It would appear that the on-disk representation is rather simple and straight forward, but you're only supposed to use a ColorForth aware editor (eg: ColorForth)]
- jstanley 11y ago> I keep forgetting that DVCS are rather new (as in popular, free-software DVCS are pretty new - git is just over 10 years). Are you saying git is not popular, is not free software, or something else?