[TransWarp] The new binding API names

Phillip J. Eby pje at telecommunity.com
Thu Sep 4 14:04:45 EDT 2003


Okay, after further discussion, we've got it nailed down to these three:

binding.Require("what's needed")
binding.Obtain(key)
binding.Make(factory)

Require means that the user of the component must supply the value 
directly.  Obtain means that the desired object/value must be able to be 
found by the component.  Make means that the component will produce the 
needed object/value on its own.  All three, of course, will be overrideable 
by subclassing, setattr, or constructor keyword arguments.

The mapping from the old API to the new is pretty straightforward.  Once 
and New will be Make.  bindTo and bindSequence will be 
Obtain.  requireBinding will be Require.  All of the lesser APIs will then 
fold into special cases, e.g. binding.Constant will probably become 
Make(value=whatever), binding.Copy(expr) will be binding.Make(lambda: 
expr), and so on.

This won't be implemented immediately, as there's some groundwork I want to 
do first, like adding a 'protocols.sequenceOf()' API, so that we can easily 
define adapters from sequences of things.  I do intend to do have it 
completed (and the old API marked deprecated) in the 0.5a3 release.  Some 
time after 0.5a3 is released, the old API will be removed.

In practice, y'all should have lots of time to make the change, because 
I'll have to do significant surgery on the tutorial before the a3 release, 
in order to document the new API.




More information about the PEAK mailing list