[TransWarp] Input wanted: addresses, adaptation, and attributes
alex at ank-sia.com
Wed Jun 11 16:08:20 EDT 2003
Phillip J. Eby wrote:
> Currently, when you bind to an address such as
> 'pgsql:user:pw at server/db', you get back a connection object of a
> "hard-wired" type. To change this, you have to specify custom "object
> factories" in the retrieval context, which requires fairly intimate
> knowledge of both what address is going to be used, and how the
> underlying name retrieval mechanism works.
> I'm thinking that it would be better (for some definition of better) to
> use adaptation for this. For example:
> myConn = binding.bindTo(
> 'pgsql:user:pw at server/db', adaptTo=storage.ISQLConnection
> A trade-off here is that when you have something that really does need
> to be "retrieved", you'll now need to create an actual naming context.
> For example, the 'import:' scheme that's in PEAK now should really
> always have been a naming context, because there are actual objects to
> be retrieved by importing. But for SQL URLs, there isn't anything to
> "retrieve". It's just an address.
> My thought at this point is that naming contexts should retrieve generic
> objects according to what kind of context they are, and users then adapt
> to specific objects. So, the 'import:' URL should have a context that
> loads the named object (and then you can adapt it if needed). Pretty
> much all other address types would stay as is, just being returned by
> the context that looks them up.
i am sorry, i understood almost nothing of all this.
till now, i only used importString() to get a well-known class from a
well-known module. of course, that class did implement an expected
i have no idea about what may be a context for 'import:' scheme.
and i have no idea how the naming contexts (roughly speaking,
binding.Components, right?) may adapt generic objects according to what
kind of context they are.
> Comments, anyone?
making the interfaces clearer seems to be a good thing, but again, i did
not understand much of the proposal.
> Will this break too much? Does the requirement of specifying an
> interface for a binding (or lookup) seem too strict?
does this mean that each config.getProperty or binding call will have to
be rewritten with 'adaptTo' argument? if yes, that would hurt, for sure.
More information about the PEAK