E&S CVS Commit: PyProtocols - Add support for "subclassing" (subcontexting?) generic functions. Single-

pje at eby-sarna.com pje at eby-sarna.com
Wed Nov 10 18:48:00 EST 2004


Module Name:	PyProtocols
Committed By:	pje
Date:		Wed Nov 10 23:47:59 UTC 2004

Modified Files:
	PyProtocols/src/dispatch: functions.py interfaces.py strategy.py
	PyProtocols/src/protocols/tests: test_dispatch.py

Log Message:
Add support for "subclassing" (subcontexting?) generic functions.  Single-
dispatch functions now offer a 'clone()' method that returns a new generic
function that inherits all the previous and subsequent definitions added
to the "base" generic function.  Multi-dispatch functions automatically
tailor definitions to the class they're in, if their '.when()' is called
directly from a class body.  (We may want to add option(s) to override or
modify this behavior in the future, but I think it's a good default.)
Note that the 'dispatch.generic()' decorator now creates a "real" function
object, instead of returning a 'GenericFunction' instance.  The returned
function's attributes just point to corresponding attributes on a hidden
'GenericFunction' instance.


To view diffs of this commit, you can use the following URL(s):
http://cvs.eby-sarna.com/PyProtocols/src/dispatch/functions.py.diff?r1=1.8&r2=1.9
http://cvs.eby-sarna.com/PyProtocols/src/dispatch/interfaces.py.diff?r1=1.6&r2=1.7
http://cvs.eby-sarna.com/PyProtocols/src/dispatch/strategy.py.diff?r1=1.4&r2=1.5
http://cvs.eby-sarna.com/PyProtocols/src/protocols/tests/test_dispatch.py.diff?r1=1.18&r2=1.19

To generate a diff of this commit:
cvs rdiff -r1.8 -r1.9 PyProtocols/src/dispatch/functions.py
cvs rdiff -r1.6 -r1.7 PyProtocols/src/dispatch/interfaces.py
cvs rdiff -r1.4 -r1.5 PyProtocols/src/dispatch/strategy.py
cvs rdiff -r1.18 -r1.19 PyProtocols/src/protocols/tests/test_dispatch.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