Mathieu Bouchard wrote:

> On Sat, 26 Mar 2005, gabriele renzi wrote:
> 
>>I'm starting to think we could have a RubyBase package on RAA to provide 
>>lots of useful mixins (basically for fat classes i.e. IO::Readable, 
>>IO::Writable, String::MixIn, Array::MixIn, but also for new things).
>>What do others think?
> 
> 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.

Certainly still an interesting project. Does it work properly on 1.8? Is 
documentation available online?

> 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.

I agreed here, but found .fetch and .store to be relatively simple. The 
only complex thing is that .fetch can take fallbacks in the form of 
Objects or blocks as well. I'm not sure how to handle that, but I guess 
the situation is not too bad right now.

I'm not sure what the .put_seq and .get_seq methods do though. Do they 
somehow replace .keys and .delete?

> 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).

How would the mixin-based contract look?