From: Florian Gross Date: 2005-03-27T00:04:48+09:00 Subject: Re: Hash::MixIn and Python style Object#dict gabriele renzi wrote: > But I wonder: why both you and florian considered the need to have > contracts for this mixable things? > I used to love this, and being scared from mixins like Enumerable wich > do not have checks, but now I feel this is very non-rubyish. It's basically for letting your users check at the time they do 'include Hash::MixIn' (in this case it would be 'fulfills Hash::Contract') whether they have implemented all the prerequisites correctly. For Enumerable and so on that makes not too much as the only preconditions are providing an .each method, but I think that this could in general be quite powerful. I've also tried to switch away from Class-based typing entirely and to instead use unit testing for defining contracts. I'm not sure of the exact implications, but it was nice to finally implement this idea that I had for so long. I've not fully explored all the possibilities though so expect to see changes and additions in the future.