From: gotoken@... (GOTO Kentaro) Date: 2001-01-09T00:52:10+09:00 Subject: [ruby-talk:8878] good container? In message "[ruby-talk:8820] Re: No :<, :>, etc. methods for Array" on 01/01/08, "Christoph Rippel" writes: >I see your point ... . I guess my idea was to be less greedy >and to reorganize the current Array and Hash classes in a class >hierarchy which effectively takes away (and sometimes adding and/or >redefining) most of their current functionality. The core languages >does not provide among others things a predefined Stack class, >(Multi)Set (or their ordered variants)- instead this functionality >was ``crammed into'' the Hash and Array container classes taking >away clarity of intent, functionality, possible optimizations and >as Kevin points out creating class interfaces with a pretty steep >learning curve. > >In my opinion it would be a good thing if the standard Ruby >distribution would ship with a ``nice library'' of well integrated >basic container classes I see what you say just now. Thank you Christoph. Well, such development can be done efficiently by release-test-improve loop. So, I'd like to wait RAA-entry(s) of containers written by anyone. If cachy one appears for everyone, Matz adopt that as a standard library. >class ContainerClass >ZERO = 0 # or something similar like the hypothetical Numeric::ZERO >def def sum(if_empty = type::ZERO) >.. >end >... >end > >This way you can override the generic ZERO in a specialized >ContainerClass I think operations like sum is a kind of cross-hierarchical spec of container and it should be provided as mix-in, perhaps. Cle and me had a series of discussions about container hierarchy in the context of how to realize sutably reverse ordered version of each. You can find them in some threads, e.g.: `New feature for Ruby' http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/407?404-621 Thanks, -- Gotoken