Wiki

Changes between Version 7 and Version 8 of Methods

Show
Ignore:
Timestamp:
01/08/13 00:30:03 (12 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Methods

    v7 v8  
    9797A method body is the code that implements the methods actions or behaviour.[[BR]] 
    9898 
    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. 
     99In 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. 
    100101 
    101102Contract prerequisites are tagged with the keyword suffix '''require'''. [[BR]] 
    102103Postconditions are suffixed with keyword '''ensure'''.[[BR]] 
    103104Both 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 
    104107Tests are always in an indented clause following the '''test''' suffix keyword. 
    105108 
    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. 
     109If 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  
     111single or multiple prerequisite or postcondition  expressions are given (in an indented clause)[[BR]] 
     112then the method body ''must'' also be tagged with the keyword suffix '''body''' and the method body code placed in a following indented clause. 
    113113 
    114114Examples