Perl6 Object Oriented Cookbook (v0.2.1)  
Section 9: Assertions and Invariants  
 
Recipe 9.16: Placing Postconditions on Method Arguments
Last Updated: Sep 8, 2003
Status: Draft
      Previous Page   Next Page

How important is this problem to you?
  (Login to Vote)
5.00 Rating, 1 Vote  

How acceptable is the proposed solution?
  (Login to Vote)
0.00 Rating, 0 Votes  

Problem:  

Your method alters one of its arguments: you want to place a postcondition on that argument to ensure that the returned value is valid. You want the validity check to be part of the method interface, so that it is performed regardless of the method implementation.

Solution:  

Discussion:

(If the value is not rw, postconditions are useless)
(I'd probably rather associate multiple preconditions with the method itself, since that's more powerful and would make this obselete?)


Log In to Comment


Login / Edit User Info -- Copyright © 2002 Cognitivity -- Previous Page   Next Page