[PING][merge] Registry

John Arbash Meinel john at arbash-meinel.com
Fri Sep 15 23:17:55 BST 2006


Robert Collins wrote:

...

> A glitch: theres a typo in NEWS  - thanks for adding the entry though.
> 
> I'm -1 on Registry implementing the dict protocol. I think its
> untasteful to make objects look like dictionaries if they aren't : and
> registry is not really a dictionary : access can fail with ImportError.
> 
> specifically I think __getitem__ and __delitem__ are misfeatures for
> this class. 

Well, I would like a way to remove entries from the registry. Especially
for the test suite. But I can do that with an explicit function.

> 
> I think theres a better way to structure it where it *is* a dictionary:
> 
> Have a class to represent lazy-load-with-help objects, this has methods:
> fetch_object()
> help_string()
> extra_info() 
> 
> etc.
> 
> Then the big Registry is nothing more than a {} of LazyLoadWithHelp()
> objects, and the confusion between 'is this a dict or not' goes away.

Except not all of the objects are going to be lazy. The point is that
Registry is going to be used in places where you may already have the
object/class/whatever, and in someplaces you will only know that there
is one *over there*.

The other purpose of Registry is to give some structure to all of the
places that we have already that register objects. Commands and
Transports are just the first few. I'd like to make Commands lazier, and
I'd like to add something like this to all of the Formats that we have.
(Branch/Repository/WorkingTree). Currently importing 'builtins.py'
actually costs us quite a bit of startup time. (Though interestingly
enough errors.py is probably the most expensive single file in bzrlib,
and I don't know what we can do about that one just yet).

> 
> So, I'd rather not see this merged as is.
> 
> -Rob

Okay. We can discuss changes for 0.12.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060915/8db9d7f4/attachment.pgp 


More information about the bazaar mailing list