E&S CVS Commit: PEAK - Semi-final renamings/refactorings for 'peak.model' API. Hopefully,
pje at eby-sarna.com
pje at eby-sarna.com
Sat Feb 22 10:57:00 EST 2003
Module Name: PEAK
Committed By: pje
Date: Sat Feb 22 15:56:07 UTC 2003
Modified Files:
PEAK/src/peak/model: datatypes.py enumerations.py interfaces.py
persistent.py structural.py
PEAK/src/peak/model/tests: __init__.py
Log Message:
Semi-final renamings/refactorings for 'peak.model' API. Hopefully,
this will be the last set of significant, user-visible changes.
Renamings:
- model.Classifier -> model.Type
- model.IClassifier -> model.IType
- model.IEnumClass -> model.IEnumType
- someType.fromString() -> someType.mdl_fromString()
- someType.fromFields() -> someType.mdl_fromFields()
(Note: 'someFeature.from*' methods remain unchanged.)
* Removed default 'referencedType' definition, as it was leading to
sloppy code, such as in the 'peak.model' unit tests. Features
should *always* declare a type; explicit is way better than implicit
in this context.
* Added 'feature.normalize()' and 'type.mdl_normalize()' method pair.
A feature calls its 'normalize()' to convert and/or validate a
value that's being set or added into the feature. No semantics
have been established yet for this method in the default datatypes
(i.e. in 'model.Integer', etc.), so this is a likely area for future
work to continue.
* Added 'model.Any' type, whose typecode kind is 'tk_any' and accepts
any value as valid.
* Adjusted use of 'feature.defaultValue' so that it falls back to
'feature.typeObject.mdl_defaultValue' if 'defaultValue' isn't defined
in the feature or one of its base classes. This allows types to
declare a default value.
* Made it easier to define 'mdl_' special methods, by adding metaclass
code to make all 'model.Type' derivatives automatically convert
functions whose name starts with 'mdl_' into classmethods. (By
definition of the interface, any 'mdl_' attribute of a 'model.Type'
should be a class attribute anyway.)
The next big change is likely to be the splitting of the 'structural'
module into separate 'elements' and 'features' modules, as 'structural'
is currently the single longest source file in PEAK, at almost 5 times
the average module length. But this shouldn't be a "user-visible"
change, since the API exported from 'peak.model' will remain unchanged.
Apart from this, I expect to do some performance tests and perhaps some
tuning. This may lead to some changes, but only at the SPI level,
rather than the API level. That is, the changes should only affect
people who were re-implementing the dependent interfaces or overriding
low-level hooks like '_setBinding()'.
To view diffs of this commit, you can use the following URL(s):
http://cvs.eby-sarna.com/PEAK/src/peak/model/datatypes.py.diff?r1=1.13&r2=1.14
http://cvs.eby-sarna.com/PEAK/src/peak/model/enumerations.py.diff?r1=1.5&r2=1.6
http://cvs.eby-sarna.com/PEAK/src/peak/model/persistent.py.diff?r1=1.5&r2=1.6
http://cvs.eby-sarna.com/PEAK/src/peak/model/interfaces.py.diff?r1=1.15&r2=1.16
http://cvs.eby-sarna.com/PEAK/src/peak/model/structural.py.diff?r1=1.30&r2=1.31
http://cvs.eby-sarna.com/PEAK/src/peak/model/tests/__init__.py.diff?r1=1.10&r2=1.11
To generate a diff of this commit:
cvs rdiff -r1.13 -r1.14 PEAK/src/peak/model/datatypes.py
cvs rdiff -r1.5 -r1.6 PEAK/src/peak/model/enumerations.py \
PEAK/src/peak/model/persistent.py
cvs rdiff -r1.15 -r1.16 PEAK/src/peak/model/interfaces.py
cvs rdiff -r1.30 -r1.31 PEAK/src/peak/model/structural.py
cvs rdiff -r1.10 -r1.11 PEAK/src/peak/model/tests/__init__.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