[darcs-devel] Hi there. Crazy ideas?

Yuval Kogman nothingmuch at woobling.org
Thu Jun 9 00:26:25 PDT 2005


On Wed, Jun 08, 2005 at 18:57:56 -0300, Flavio Botelho wrote:
> Hello,
> 
> I am just starting to learn Haskell and was looking for something fun
> to do in it. When i found darcs i reminded of an old idea i had when
> using bitkeeper in another oss project.

Please make sure you're legally allowed to develop darcs, if you are
a former BK user.

Actually, how was it legal for Linus et al to write git?

> The idea is to use the EBNF definition of the language, or any any
> format to create parsers and then create diffs for each programming
> language based on its parsing syntax, such a diff would be able for
> example to tell that only comments were added.
> Or, where it is more useful, to tell for example that one block of
> code hasnt been changed, that it just has been put inside and 'if' for
> example.
> Or that 2 changes in the same line affect different parts of the
> syntatic tree...

Basically what you need is to translate the sigma of your
programming language into a more diffable representation, that is
then diffed by a more general algorithm, and finally serialized back
into the language.

> What do you think? Is this a interesting idea?

Very =)

But hard, too... Darcs is popular for small projects, which tend to
use more modern languages. The languages are changing, and although
the process is slow, it can make our head hurt.

I think the only sane approach is to link with the interpreters of
such langauges, and use them to parse.

There's a heap of other problems to deal with, but in theory this is
the Holy Grail of VCS... Imagine getting a notice about a conflict
when a function name changes but another file uses the old one.

Perhaps plugins to "understand" the repo should be part of the repo,
and not part of darcs itself.

A proposal I had a while ago, for better diffs of binary files, was
to use an unpacking script, check into darcs. When it finds a binary
file, the script is run, in a temp dir.

The script is responsible for creating a more diffable
representation in the dir.

The script must also know to reverse.

Here's how the scenario might work on an MP3 archive for example:

	* the script demuxes, putting all ID3 data in a text file, and
	all frames in a binary file, and an index of how to recompose
	them in a third file.

	* darcs diffs the dirs unpacked from the old and new versions of
	the file, finding out that "Artist Name" was changed in the text
	file representing ID3 frames.

	* the textual diff is stored, and the patch depends on a
	specific version of the unpack script.

> My knowledge of Haskell is very poor, i am thinking of doing a
> prototype, later on if it works well, others could become involved.

I am in the same boat, actually, so here's a shameless plug:

I'm writing a forth to parrot compiler in haskell, so that I can
learn all three. I'm documenting my progress in a tutorial format.

	http://feather.perl6.nl/~nothingmuch/harrorth/

The forth is ugly right now, but this is on my agenda today.

This is probably best suited for people who have gone through a
haskell tutorial, got things right, but still don't know what to do
with the knowlege, because of all the deep magic floating about.

-- 
 ()  Yuval Kogman <nothingmuch at woobling.org> 0xEBD27418  perl hacker &
 /\  kung foo master: /me supports the ASCII Ribbon Campaign: neeyah!!!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.osuosl.org/pipermail/darcs-devel/attachments/20050609/9562461e/attachment.pgp


More information about the darcs-devel mailing list