[PING][merge] Registry

John Arbash Meinel john at arbash-meinel.com
Thu Sep 21 22:28:04 BST 2006

Robert Collins wrote:
> On Thu, 2006-09-21 at 10:57 -0500, John Arbash Meinel wrote:
>> Robert Collins wrote:
>>> On Fri, 2006-09-15 at 17:17 -0500, John Arbash Meinel wrote:
>>>> 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*. 
>>> Seems to me that a subclass of the LazyLoader which is given the real
>>> object would fit this quite well, with no loss of generality.
>>> -Rob
>> Not really. LazyLoader is designed so that it replaces an existing
>> object once it is used (a member is called on it). Which means it is not
>> suitable for constants, and sometimes not for class definitions.
>> (constants may not have members, and class definitions are occasionally
>> used as isinstance(foo, Klass), which doesn't trigger an import).
>> But more importantly, Registry is meant to be used as a 'load this on
>> request' not a 'load this once I use it'. It is a subtle but important
>> difference.
> I think that difference makes it more important, not less, that the
> Registry container be just a regular dictionary, and the objects in it
> be the things that can load on request, not on access.
> Perhaps we are talking past each other ?
> -Rob

But you don't ever make a request on a constant. Only a class or
function. And if you use a class in 'isinstance(foo, class)' you don't
make a request either.

And more importantly, we want some sort of real class to create policy,
and uniformity between all the locations that use it. Though maybe you
are just thinking it would be a wrapper around a plain dictionary.


-------------- 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/20060921/1ec7c252/attachment.pgp 

More information about the bazaar mailing list