From: Dave Thomas Date: 2000-07-10T10:02:11-05:00 Subject: [ruby-talk:03913] Re: require, ensure, and Design by Contract Aleksi Niemel� writes: > > and to be > > able to perform the wrapping on subclasses when needed. > > Could you say what's the need here? Why do we have to wrap them? To enforce contracts on their methods. > > def incr(n) > > n + 1 > > end > > { post: result == n.old + 1 } > > What if the post is real method and working like my example later? > Can't we pass the copy of the arguments? (Probably not, because it > leads to some other weird problems... But even so, I don't follow > you here. The expression uses a variable 'n', but we can't tell what 'n' is: we can guess that it's a parameter, but there is no reflection mechanism that gives you the names and positions of a parameter, so the wrapper can't synthesize it. > I'm not sure we're really implementing full-scale Eiffel-type of DBC > here. I think I saw someone (maybe Dave) saying it's not entirely > clear we have need for automatic invariant since we can always do it > explicitly: That wasn't me. I'm a lazy sod, so I'd use the minimal typing and most automation available ;-) Regards Dave