On Wed, 15 Mar 2000, Clemens Hintze wrote:

> Hugh Sasse Staff Elec Eng writes:
> > Has anyone any examplse of using the Enumerable module?  I've had a 
> > look around, but not found much.  I'm thinking of something to allow
> > me to have names for bits in a flag field, so I can test if one or
> > more is set.
> 
> Hi,
> 
> if I have not misunderstood your question, I think you have
> misunderstood the purpose of module Enumerable ;-)))
> 
> Enumerable offers some methods like: min, max, sort, ... that could be
> included into any class that provide the method 'each'. After
> including, the class get all methods of Enumerable for free ...

So that is all.  I saw a bunch of methods based on each but was not
sure how that imeplemented enumerated types -- I learnt Pascal years
ago (yikes! :-) it's nearly 18 years!) so that is the concept I had in
mind, it clearly has stuck
> 
> Classes Array or IO of the standard lib, include Enumerable for
> example. Here is a another one:
> 
	[nice example trimmmed]
> 
> You can see, although there is no method 'max' or 'to_a' defined for
> MyRange, any instance can use them, because they are coming from
> Enumerable. As you can include more than one module, it is somewhat
> similar with multiple inheritance. But cleaner, IMHO.
> 
	Thank you.

> > I could create my own object for this, of course, but
> > why re-invent unless I must?
> 
> Here, I think, it would not be re-invention but invention. There is no
> such class, AFAIK.

	OK.  I will see if I can generalise this when I create it.
> 
> \cle
> 
	Thank you
	Hugh
	hgs / dmu.ac.uk