Changes between Version 7 and Version 8 of Methods
- Timestamp:
- 01/08/13 00:30:03 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Methods
v7 v8 97 97 A method body is the code that implements the methods actions or behaviour.[[BR]] 98 98 99 In addition to the body, a methods contents may also include optional contracts specifications (pre method entry prerequisite conditions and post method exit postconditions )and optional Test clauses. 99 In addition to the body, a methods contents may also include optional contracts specifications [[BR]] 100 (pre method entry prerequisite conditions and post method exit postconditions ) and/or optional Test clauses. 100 101 101 102 Contract prerequisites are tagged with the keyword suffix '''require'''. [[BR]] 102 103 Postconditions are suffixed with keyword '''ensure'''.[[BR]] 103 104 Both of these may be a single expression (on the same line as keyword) or an indented clause on line following the keyword.[[BR]] 105 (see wiki:Contracts for an expanded description) 106 104 107 Tests are always in an indented clause following the '''test''' suffix keyword. 105 108 106 Inherited methods may augment contracts provided on ancestor methods.[[BR]] 107 Prerequisites may be relaxed, postconditions can only be increased (??). [[BR]] 108 Such augmentation is noted by an extra leading suffix :[[BR]] 109 giving '''or require''' for preconditions, '''and ensure''' for postconditions[[BR]] 110 otherwise contracts on submethods replace any contracts on ancestor methods. 111 112 If tests or contracts are specified and any of these are indented clauses (i.e if any tests are given (always in an indented clause) or single or multiple prerequisite or postcondition expressions are given (in an indented clause) then the method body ''must'' also be tagged with the keyword suffix '''body''' and the method body code placed in a following indented clause. 109 If tests or contracts are specified and any of these are indented clauses[[BR]] 110 (i.e if any tests are given (always in an indented clause) or 111 single or multiple prerequisite or postcondition expressions are given (in an indented clause)[[BR]] 112 then the method body ''must'' also be tagged with the keyword suffix '''body''' and the method body code placed in a following indented clause. 113 113 114 114 Examples