Mathieu Bouchard ha scritto: > MetaRuby (http://artengine.ca/matju/MetaRuby/) provides that, with > examples implementing #undo/#redo, BitArrays, InstanceVariablesHash, > MethodsHash, FileAsString, ProcAsArray, ... And those examples are all > very short. yes, I know about metaruby but I supposed that it did not work with ruby 1.8. Anyway IIRC your metaruby has one thing I disliked, since it does not provide a fine grained functionality splitting, I mean, there are HollowIO and HollowHash instead of Input+Output+Seekable+whatever and Map+EnumerableMap+whatever. I may recall wrong, though. > Incidentally I have found that letting the user define #[] and #[]= is a > bad idea because those methods are too complex (I mean those in Array and > String) and instead I make the user implement #put, #put_seq, #get, > #get_seq, for which I give extremely simple definitions. Yup, I agree > I also use a mixin-based contract together with a mixin-based > implementation. I used to call it all ArrayMixin, HashMixin, etc., and > later changed the name because people found it was a bad name, and the > current names are worse because I confused two similar words in English > (it's a bad idea to assume my English is excellent just because I use a > lot of vocabulary: it's *not*). If I resume that project the names of the > three containers will change again (but all the rest will stay essentially > the same). why those were bad name? FWIW I found names like SomethingP *crazy* the first time I read the code, but now I think of them as lispy things and I can accept them :) 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.