RFC: centralise registries

Robert Collins robert.collins at canonical.com
Wed Apr 15 05:57:45 BST 2009


On Wed, 2009-04-15 at 14:42 +1000, Martin Pool wrote:
> 2009/4/14 Robert Collins <robertc at robertcollins.net>:
> > That solves one instance of this issue; there are quite a few registries
> > now. Calling back to plugins is what I mentioned in one of my other
> > mails.
> >
> > Hooks have the same issue as registries actually - you have to load the
> > hook object you want to register with for callbacks, and like registries
> > we have them near the code to run [good] but this means we load code we
> > may not need.
> >
> > I think actually the root of the issue is that there is no way for a
> > plugin to say 'I would register with some X but I don't want to trigger
> > that X'. twisted achieves this by plugin metadata - plugins are a Y, and
> > this is memoised and then the plugin is called into for Y operations. I
> > think this is overly constraining.
> ...

> It seems like this is just shuffling the problem around.  You still
> have, essentially, a registry, it's just now called lazy_load_hooks.
> We come back to wanting to make sure that it's possible to register
> for things without loading much more code, whether that be by directly
> making sure the places they currently live are cheap, or putting them
> somewhere else.

registries are not a problem; registries that are only loaded to allow
the registry to be registered with are. E.g. a registry for 'diff' is a
time waste except when diff code is invoked.

> You don't actually care about knowing when the module is loaded for
> its own sake, so I'd be disinclined to add a mechanism that does that.

At the moment I can't think of any mechanism that is higher up and not
basically emulating that || centralising everything.

> >> Arguably loading bzrlib.tests should be made much faster by splitting
> >> out the various bits aggregated into that module.  You ought to be
> >> able to think about testing without needing to actually load all the
> >> code needed to run the tests.
> >
> > Well, what does 'think about testing' mean here :).
> 
> For instance, importing the TestCase base class.

But that class is the code to run tests; or do you mean the reporting of
test results stuff?

-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090415/898964a7/attachment.pgp 


More information about the bazaar mailing list