[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] "semantic" diff/merge tools
From: |
Ludovic Courtès |
Subject: |
Re: [Gnu-arch-users] "semantic" diff/merge tools |
Date: |
Tue, 11 Oct 2005 18:39:49 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
Thomas Lord <address@hidden> writes:
> Sexps denote abstract trees -- which is a semantics of a sort
> but a very weak one. From the diff perspective, a bytestream
> denotes a list of lines, each a list of characters -- a semantics
> of comparable complexity.
Right, sexp are a simple semantics. Yet, to the Scheme/Lisp programmer,
it might make sense to be able to visualize an sexp-diff (a tree diff in
fact) rather than that classic line-diff which is completely
disconnected from the actual data structure it is representing.
> In contrast, a semantically oriented application-specific diff/merge
> tool for a word processor document isn't performing generic operations
> on trees. It would know, for example, not to try to recursively
> compare the contents of a tree node representing a text paragraph
> to a tree node representing, say, a diagram. It's the difficulty
> and expense of writing such rules, multiplied by the number of
> present and future applications for which they are desirable, that
> I object too and that lead me to propose a family of data file formats
> that can make good use of generic diff/merge tools.
You rightfully note that document are actually trees. I might add that
XML is really sexps with a different (weird) syntax. This means that if
you have a tree differencer (which could be based on sexps), you're on
your way to having a document-aware diff tool. Of course, more needs to
be done so that it knows more about what it is diffing.
> A "best of both worlds" approach is to use data file formats that
> can make good use of generic merge tools, but then permit (rather
> than "require") applications to provide non-generic alternatives.
That's one possibility. For sexps/XML, for instance, I think the
tree diff approach may provide better results than per-line diff.
Thanks,
Ludovic.