Re:History of version control - 10 astonishments
by gbog on Sunday December 18, 2011 @03:27AM
(#3366259)
This sounds like a bad idea. Code is text. If ast helps merging diffs, why not use it for analysis in case of conflict and keep code as text?
[ Parent
| on HN ]
Re:History of version control - 10 astonishments
by tikhonj on Sunday December 18, 2011 @08:18AM
(#3366573)
I think it's most accurate to say that code is a textual representation of an AST. Saying that it's just text is just like saying it's just a bunch of numbers--both technically true but missing the bigger picture.
One potential reason no to store code as text is that there are many equivalent programs that differ only in inconsequential text. A perfect example is trailing whitespace.
There are also some benefits of storing code as an AST. For one, it would make it trivial to identify commits that did not change the actual code--things like updated comments. This would help you filter out commits when looking for bugs. Another benefit would be better organized historical data: in a perfect system, you would be able to look at the progress of a function even if it got renamed part of the way through.
Re:History of version control - 10 astonishments
by adambyrtek on Sunday December 18, 2011 @08:55AM
(#3366620)
But then you end up with a version control system that is not generic, but dependent on a particular language. The story of Smalltalk suggests that the added value might not be worth the coupling and complexity it requires.
Re:History of version control - 10 astonishments
by tikhonj on Sunday December 18, 2011 @05:02PM
(#3367619)
You should be able to write a generic version control system like this where you can just plug the appropriate parser in and it would work for that language. For backup, you could have it still keep some files as text.
Re:History of version control - 10 astonishments
by viraptor on Sunday December 18, 2011 @06:35AM
(#3366437)
Because you can always convert from ast to text, but not always from text to ast. Also it's easier and faster to convert ast->text, and you can do it when needed only. Additionally you'd never commit a syntax error. Why is it a bad idea?