| 1 |
Revision history for Perl extension Class::Contract. |
| 2 |
|
| 3 |
Planned for next release: |
| 4 |
|
| 5 |
- Long overdue documentation update |
| 6 |
|
| 7 |
- Rewrite tests using MSCHWERN's new Test::Harness |
| 8 |
|
| 9 |
- Flattening and shortening |
| 10 |
|
| 11 |
|
| 12 |
1.14 Mon Jun 18 16:28:02 2001 |
| 13 |
|
| 14 |
- <C>croak</C> and <C>carp</C> are wrapped to facilitate reporting |
| 15 |
correct file and line numbers within <C>impl</C>. Previously it was |
| 16 |
hard to get useful file/line information when throwing an exception |
| 17 |
within implementations. |
| 18 |
|
| 19 |
- <C>private</C> |
| 20 |
Forgetting to declare an inherited private method private |
| 21 |
will cause croak. If for example you are adding pre/post-conditions |
| 22 |
or defining a new implementation for a derived method, you must |
| 23 |
declare it 'private', or an exception will be raised. |
| 24 |
|
| 25 |
- <C>old</C> is now off by default. I have noticed, and others have |
| 26 |
complained that it caused too much overhead. To toggle on/off per package: |
| 27 |
use Class::Contract 'old'; |
| 28 |
no Class::Contract 'old'; |
| 29 |
|
| 30 |
|
| 31 |
1.13 Mon May 07 10:47:21 2001 |
| 32 |
|
| 33 |
- Fixed deep copy of scalar references. Was breaking <C>old</C> and |
| 34 |
<C>clone</C>. |
| 35 |
|
| 36 |
|
| 37 |
1.12 Tue Mar 13 08:53:06 2001 |
| 38 |
|
| 39 |
- Removed cruft from t/method.t test which was causing a false |
| 40 |
indication of test failures on some platforms. No code changes |
| 41 |
to Class::Contract itself. |
| 42 |
|
| 43 |
|
| 44 |
1.11 Mon Mar 05 10:31:54 2001 |
| 45 |
|
| 46 |
- Added support for clone method which may be used as you might imagine. |
| 47 |
To clone an object. Like ctor you may use clon to define initialization |
| 48 |
pre, impl, post, and invar clauses to execute when cloning an object. |
| 49 |
|
| 50 |
- Fixed problem working with objects which weren't created with |
| 51 |
Class::Contract. Problems arose when an object wasn't a scalar reference. |
| 52 |
|
| 53 |
- Fixed typo in _dcopy which broke deep copying of scalar references |
| 54 |
|
| 55 |
|
| 56 |
1.10 Sun Feb 09 12:15:31 2001 |
| 57 |
|
| 58 |
- Added missing <C>old</C>. It was documented but not implemented |
| 59 |
|
| 60 |
- &self is now only way to access object/class reference. Use |
| 61 |
self(self->next) instead of $_[0] = $_[0]->next. |
| 62 |
|
| 63 |
- refactored all condition checking to use <C>generic_check</C> function |
| 64 |
|
| 65 |
- revisted _inheritence and generic_check. Think I've finally got |
| 66 |
weakening pre-conditional checks working correctly. There is a good |
| 67 |
test covering this in t/method.t |
| 68 |
|
| 69 |
|
| 70 |
1.04 Wed Jan 31 15:45:42 2001 |
| 71 |
|
| 72 |
- Begun the process of writing extensive tests. Finding and |
| 73 |
fixing many bugs. |
| 74 |
|
| 75 |
- Calling a class accessor or method with an object reference |
| 76 |
will now auto-magically change &self into a class name reference. |
| 77 |
This was documented but not implemented. The converse, calling an |
| 78 |
object accessor or method with a class reference causes an assertion |
| 79 |
|
| 80 |
- Added keyword 'private'. Methods declared private can only be |
| 81 |
invoked by the class or its descendants. |
| 82 |
|
| 83 |
- Added optional exportation of shortcuts: scalar_attrs, array_attrs, |
| 84 |
hash_attrs, methods. Allows defining clauses like: |
| 85 |
abstract methods qw( foo bar baz ); |
| 86 |
|
| 87 |
- Fixed inheritence of pre-condition and implementation sub-clauses. |
| 88 |
Sub-clauses weren't always inherited when the derived class |
| 89 |
failed to define one. |
| 90 |
|
| 91 |
- Fixed pre-condition checks. Satisfying self or any ancestor |
| 92 |
wasn't working correctly when either the ancestor or the |
| 93 |
derived class did not define any preconditions. |
| 94 |
|
| 95 |
- &inherits now croaks on circular references in inheritence |
| 96 |
|
| 97 |
- Rewrote _location so we can now use eval within the |
| 98 |
contract statement to generate attribs, methods, etc. |
| 99 |
|
| 100 |
- Post conditions and invariants can no longer modify by |
| 101 |
reference a method's @_. Now conditional checks receive a |
| 102 |
@{[@_]} shallow copy. |
| 103 |
|
| 104 |
- Fixed flyweight objects returned by constructor to avoid a |
| 105 |
dangling reference which was preventing garbage collection. |
| 106 |
|
| 107 |
The flyweight object is a blessed reference to $key which is |
| 108 |
itself a reference to an undefined lexical scalar. $key is |
| 109 |
also used as the hash key to the lexical %Class::Contract::data |
| 110 |
which stores a given object's data. Previously constructors |
| 111 |
returned $key. Consequently, when an object went out of scope |
| 112 |
in your script, %data continued to reference $key. Now, when the |
| 113 |
flyweight, which is not internally referenced by Class::Contract, |
| 114 |
goes out of scope its destructor clears $data{$key}, and Perl's |
| 115 |
garbage collection takes place. For a coherent explanation of |
| 116 |
such issues read section 13.13 of the Perl Cookbook, 1st Edition. |
| 117 |
|
| 118 |
- Fixed multiple inheritence to appropriately handle cases where |
| 119 |
a descendant might inherit the same base class through 2 or |
| 120 |
more intermediary classes. I.e. diamond patterns in inheritence |
| 121 |
tree. This affects inheritence of invars, attributes, methods, |
| 122 |
constructors, and destructors. Previously, it was possible to have |
| 123 |
a base class' initialization code called multiple times by a |
| 124 |
descendant's constructor. Once for each ancestor with the common |
| 125 |
base class. |
| 126 |
|
| 127 |
- Fixed multiple inheritence with regard to constructor |
| 128 |
initialization to be left-most depth-first, instead of |
| 129 |
right-most depth-first. Destructors are the symetrical opposite |
| 130 |
right-most derived-first. |
| 131 |
|
| 132 |
|
| 133 |
1.03 Wed Dec 27 14:06:11 2000 |
| 134 |
|
| 135 |
- Reformatted source to new maintainer's tastes. 2 space indent |
| 136 |
and tabs, removal of barewords, foreach instead of for, etc. |
| 137 |
Otherwise no changes to the underlying code. |
| 138 |
|
| 139 |
|
| 140 |
1.02 Fri Dec 21 10:22:48 2000 |
| 141 |
|
| 142 |
- One line change to C<generic_precheck> to fix improper skipping |
| 143 |
pre-conditional checks in some cases (thanks Jeff) |
| 144 |
|
| 145 |
|
| 146 |
1.01 Fri Dec 9 09:52:02 2000 |
| 147 |
|
| 148 |
- Change to generic constructor to work around magical limitations |
| 149 |
of overload.pm. Should now play nicer with overload.pm |
| 150 |
|
| 151 |
- Reversed ordering of Changes (this document) |
| 152 |
|
| 153 |
- Updated documentation to reflect probationary new maintainer |
| 154 |
C. Garrett Goebel, GGOEBEL, <[email protected]> |
| 155 |
|
| 156 |
|
| 157 |
1.00 Sun Aug 6 07:11:35 2000 |
| 158 |
|
| 159 |
- Changed semantics of preconditions. |
| 160 |
Now only inherited if not defined in same class |
| 161 |
(this conforms with the notion of derived classes |
| 162 |
being allowed to weaken, but not strengthen preconditions). |
| 163 |
|
| 164 |
- Added postconditions on SCALAR, ARRAY, and HASH attributes |
| 165 |
|
| 166 |
- Added &value for attr conditions |
| 167 |
|
| 168 |
- Removed &result -- now uses &value instead |
| 169 |
|
| 170 |
- Added warning when explicit preconditions in derived |
| 171 |
class override inherited preconditions from base class. |
| 172 |
|
| 173 |
- Added default ctor ('new') if none specified. |
| 174 |
|
| 175 |
- Modified flyweight implementation (more robust, secure, and |
| 176 |
efficient) |
| 177 |
|
| 178 |
- Modified ctors to refuse to instantiate classes with |
| 179 |
1+ abstract methods. |
| 180 |
|
| 181 |
- Added class constructors and destructors |
| 182 |
|
| 183 |
- Changed production code mechanism |
| 184 |
(now a separate, accelerated class: Class::Contract::Production) |
| 185 |
|
| 186 |
|
| 187 |
0.05 Wed Nov 24 14:11:22 1999 |
| 188 |
|
| 189 |
- First beta version |
| 190 |
|
| 191 |
|
| 192 |
0.01 Fri Jul 23 14:35:54 1999 |
| 193 |
|
| 194 |
- original version; created by h2xs 1.18 |
| 195 |
(very much alpha) |
| 196 |
|
| 197 |
|
| 198 |
Future Plans and Ponderings: |
| 199 |
|
| 200 |
- Someday rewrite to use Attribute::Handlers |
| 201 |
|
| 202 |
- Damian's Legacy |
| 203 |
o Class Flattening and shortening |
| 204 |
o Easier mechanisms for porting code to use CC. Like allowing |
| 205 |
pre-declared subroutines to be assimilated into contract |
| 206 |
|
| 207 |
- Update documentation... |
| 208 |
o better examples of using objects in contracts |
| 209 |
o functions: scalar_attrs, array_attrs, hash_attrs, private, clon |
| 210 |
|
| 211 |
- Constructor |
| 212 |
o Allow user-defined default values for attributes |
| 213 |
o Ponder whether or not it would be a good idea to provide a better |
| 214 |
default mechanism for setting object attribute values during |
| 215 |
construction. Particularly attributes which are themselves objects. |
| 216 |
|
| 217 |
- <C>old</C> |
| 218 |
o Reexamine implementation of <C>old</C> with attention to destructors |
| 219 |
and cleanup of the temporarily allocated package namespace better. |
| 220 |
Worry about magic and stash de-allocation. |
| 221 |
|
| 222 |
- <C>post</C>: Add support for post-conditions on objects? How? Scalars, |
| 223 |
arrays, and hashes are actually tied objects and do this on destruction. |
| 224 |
Perhaps support post conditions on objects created via Class::Contract |
| 225 |
by return a blessed reference to the same $key used to lookup object data |
| 226 |
in the lexical Class::Contract %data. And provide an object attribute |
| 227 |
for post-conditions that gets called by doppleganger on destruction? |
| 228 |
|
| 229 |
- Tests |
| 230 |
o Restructure and expand |
| 231 |
o Check out new version of Test::Harness and see if I can drop the |
| 232 |
Magic.pm hack used for testing. |
| 233 |
|
| 234 |
- Add support for <C>friend</C> classes? |