gnulib-tool-py
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnulib-tool-py] Transitive closure is almost completed


From: Bruno Haible
Subject: Re: [gnulib-tool-py] Transitive closure is almost completed
Date: Thu, 12 Jul 2012 13:42:14 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Hi Dmitriy,

Sorry I was working too much again for my paid job the last few days...

> it seems that I've almost finished transitive_closure function.
> I've just done an object-oriented copy of your code, and I've done
> it inside the new class GLModuleTable.

Good! I'm glad you could reuse the old, proven algorithm.

It may disappoint you that you couldn't use the recursive algorithm that
you had planned to use. But nevertheless, maybe you learned something from
the Wikipedia pages I mentioned. And, more importantly, there is the lesson -
that you will experience many more times in the future during your career -:
some code has so many evolutions, contributions, and fine-tuning inside it
that it will take you 3 times or 10 times more effort to rewrite it from
scratch than to adapt it. In larger projects (I'm talking about code bases
10 MB large or so), it is even the common case that you have to stick to
the existing design and algorithms, and it is rare that you can simply
reinvent part of the code on your own.

> However, it seems that pygnulib produces much more modules when it finishes
> transitive closure than the old one. I've overlooked the code some times,
> but still can't find an error. Could you help me, please?

I'm sorry I can't do that ad-hoc: For reviewing just the source code I
would need to be familiar with much more of your code than I am. And for
conducting tests and guessing from sample runs what is wrong it would
be necessary that you tell how I can run that particular code. I guess
that this is changing constantly, that is why you haven't written it up
in a wiki page so far? If I need to jump in at a certain point, make it
east for me by giving me hands-on "how to reproduce" instructions.

> inmodules=`echo $handledmodules | LC_ALL=C join -v 2 - $tmp/queued-modules`
> 
> As I understand, this removes duplicated lines from and stores them in the
> inmodules.

'join' takes two sorted inputs. What does it produce with '-v 2'?
I create two test files
================= input1 =============
a
b
d
================= input2 =============
a
c
e
======================================
$ join -v 2 input1 input2
c
e

So it produces the items that are present in input2 but not in input1.
In above command, input1 is '-', i.e. standard input, i.e. $handledmodules.
In summary, it produces the queued-modules minus the handledmodules.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]