monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] RFC: Restricting app_state to commands


From: Zack Weinberg
Subject: Re: [Monotone-devel] RFC: Restricting app_state to commands
Date: Mon, 9 Apr 2007 13:54:47 -0700

On 4/7/07, Markus Schiltknecht <address@hidden> wrote:
Hm.. I like the idea of ripping out some stuff from the app_state, but
getting rid of app_state completely... I don't know. Of course the
single functions often only need one or two things from app_state, in a
complete calling path, thing sum up quickly.

Have a look at keys.cc:make_signature() for example, the function itself
already needs all of the following:

         keys.cc:make_signature()
            needs: app.opts
                   app.keys
                   app.agent
                   app.signers
                   app.verifiers
                   app.lua
[...]

Your point is well-taken - but I think you're not being ambitious
enough.  As you mention, app.signers and app.verifiers ought to be
combined with the key_store - but probably so should app.agent; I
haven't looked at the code in enough detail to be sure, but I think
Justin just made it a separate object because that was the path of
least resistance, not because it actually *needs* to be separate - and
logically, it is part of the key store.

Furthermore, if you look at the specific options and hooks that are
being used, I'd argue that they ought to be properties of the
key_store too.  With the exception of the get_passphrase hook (which
we are killing, aren't we?) they are constant across the application
run.

Probably we can combine app.signers, app.verifiers and the key_store?

Maybe combine certain options and lua hooks with the appropriate objects
(workspace, database, key_store and project), where they are used?

... heh.  Exactly.

Anyway, I would also really like to get a better separation. I have
started with (partly) ripping out the database from app_state and
passing only that where possible.

Cool.  I will look at your branch when I get a chance (probably not this week).

How do you count that stuff? Is there a script? Or a makefile target or
something?

Build before and after (in two separate directories) with "make
CXXFLAGS='-g -O2 -save-temps'", and then

$ (cd before && wc -l *.ii) > A
$ (cd before && wc -l *.s) > As
$ (cd after && wc -l *.ii) > B
$ (cd after && wc -l *.s) > Bs
$ paste A B As Bs |  awk 'BEGIN{ OFS="\t"; print "file", ".ii", ".s" }
{ if ($3 - $1 != 0 || $7 - $5 != 0) { sub(/\.ii/, "", $2); print $2,
$3 - $1, $7 - $5 } }'

(I really wish coreutils' join(1) utility were more powerful, but this works.)

zw




reply via email to

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