E&S CVS Commit: PEAK - And so we bid a fond farewell to introspection as well. 'isImplementedBy'

pje at eby-sarna.com pje at eby-sarna.com
Mon May 12 20:27:00 EDT 2003

Module Name:	PEAK
Committed By:	pje
Date:		Tue May 13 00:26:48 UTC 2003

Modified Files:
	PEAK/docs/core_tutorial: binding.tex
	PEAK/src/peak: interface.py
	PEAK/src/peak/api: __init__.py
	PEAK/src/peak/binding: components.py interfaces.py once.py
	PEAK/src/peak/config: interfaces.py
	PEAK/src/peak/model: elements.py
	PEAK/src/peak/naming: URL.py contexts.py interfaces.py names.py spi.py
	PEAK/src/peak/running: commands.py

Log Message:
And so we bid a fond farewell to introspection as well.  'isImplementedBy'
is now a thing of the past.  Refactored anything that used it, to now
use adapt(), which has now opened up a lot of extension possibilities in
places that were previously not extensible without modifying PEAK core
code.  See below.  Also, the interface module has been refactored to support
'classProvides()' in a clean and kludge-free fashion, along with support for
faster adaptation of old and new-style classes (by caching lookups, and by
safely adding '__conform__' methods to classic classes), and the ability for
classes to manage their own "implements" information.  The core interface
code is now quite elegant in the way it uses its own adaptation system as
the basis for implementing adaptation.  :)

'binding.Acquire()' now accepts a 'default' value argument, and
'binding.New()' no longer accepts the 'bindToOwner' flag.

There is a new 'binding.IComponentKey' interface that is used to implement
'IComponent.lookupComponent()'.  Now you can implement this interface,
or create an adapter for it, in order to make an object usable as an
argument to 'binding.lookupComponent()' - and therefore usable as a key
for 'binding.bindTo()' or 'binding.bindToSequence()'.  Not that it's
necessarily very useful to do so; you're probably better off simply
creating a naming scheme.  But it might be useful for lookups done
in the context of classes, since naming schemes aren't usable there.
(It was actually added in order to factor out all the type testing that
'lookupComponent' used to do, so it doesn't matter if it's useful for
much else.)

PEAK has been refactored to avoid the use of 'isImplementedBy()' and
similar introspection, in favor of 'adapt()'.  As a result, some
'peak.naming' interfaces have changed.  This should not affect you
if you are only subclassing PEAK-provided naming components and not
implementing these interfaces "from scratch".  However, the various
'isAddress', 'isAddressClass', 'isResolver', and 'isName' APIs have
also been removed, as they were based on 'isImplementedBy()'.

The ability to use 'isImplementedBy()' with interfaces declared by PEAK is
REMOVED.  You can still use 'isImplementedBy()' with Zope interfaces, of
course, but we recommend you switch to 'adapt()', which will work with both
PEAK and Zope interfaces.

To view diffs of this commit, you can use the following URL(s):

To generate a diff of this commit:
cvs rdiff -r1.35 -r1.36 PEAK/CHANGES.txt
cvs rdiff -r1.25 -r1.26 PEAK/docs/core_tutorial/binding.tex
cvs rdiff -r1.10 -r1.11 PEAK/src/peak/interface.py
cvs rdiff -r1.26 -r1.27 PEAK/src/peak/api/__init__.py
cvs rdiff -r1.110 -r1.111 PEAK/src/peak/binding/components.py
cvs rdiff -r1.11 -r1.12 PEAK/src/peak/binding/interfaces.py
cvs rdiff -r1.46 -r1.47 PEAK/src/peak/binding/once.py
cvs rdiff -r1.24 -r1.25 PEAK/src/peak/config/interfaces.py
cvs rdiff -r1.14 -r1.15 PEAK/src/peak/model/elements.py
cvs rdiff -r1.7 -r1.8 PEAK/src/peak/naming/URL.py
cvs rdiff -r1.48 -r1.49 PEAK/src/peak/naming/contexts.py
cvs rdiff -r1.37 -r1.38 PEAK/src/peak/naming/interfaces.py
cvs rdiff -r1.51 -r1.52 PEAK/src/peak/naming/names.py
cvs rdiff -r1.38 -r1.39 PEAK/src/peak/naming/spi.py
cvs rdiff -r1.19 -r1.20 PEAK/src/peak/running/commands.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

More information about the source-changes mailing list