[darcs-users] Language aware darcs

David Roundy droundy at abridgegame.org
Thu Jan 13 12:07:27 UTC 2005


On Wed, Jan 12, 2005 at 07:15:59PM -0500, Michael Conrad wrote:
> A new thought that just occoured to me is that maybe for most programming
> languages the user would just want a word-based versioning feature, and then
> people could have custom scanners for their specific language.  (and the
> scanners could retain whitespace)  Actually, I don't see why this would be
> much different than separating the file on space characters.  Or, maybe
> thats because most programming languages use space characters as token
> separators.
> 
> BTW, is their any particular difficulty that would arise if the routine that
> parses out lines were looking for space chars instead of newline chars?  I
> mean it would need a new patch type etc, but if I just changed '\n' ro ' '
> somewhere and recompiled darcs and tried versioning a brand new directory
> and didn't let the patches touch a real version of darcs... would anything
> go drastically wrong?
> 
> I might give this a try...

You could do this, but for real word-based patches it might be better to
store both the separators and the words, otherwise words that are separated
by a newline will show up as a single word "separated\nby", which almost
certainy isn't what you'd want.

Another tack which would be nice for programming languages (but less nice
for latex, or situations where you want word wrapping) would be to consider
a line as a concatenation of words.  Then you could have subline patches.
It introduces another level to the hierarchy, which could be annoying, but
would simplify certain other aspects.  So basically I'm thinking of
something like a subline-word-hunk.  But this would be far more work than
just breaking on ' ', since you'd have to change the internal data types to
store words, which would also potentially cause excessive time/memory
usages.  Of course, you'd have the same problem when just breaking on ' ',
since you'd be increasing the number of "lines" considerably.

Definitely a "good enough" solution is a good place to start (which is why
darcs currently supports just hunk and replace patches).  Relatively simple
extensions will be easier to test and debug, which would definitely be an
advantage.
-- 
David Roundy
http://www.darcs.net




More information about the darcs-users mailing list