On Fri, 5 Jan 2001 11:33:51 +0900, Kevin Smith <sent / qualitycode.com>
wrote:

>I had wondered about this myself. Since you 
>asked, I came up with:
>
>==========
>$enum_next = 0
>def enum
>	return ($enum_next += 1)
>end
>
>
>class Xyz
>	RED = enum
>	BLUE = enum
>end

I like this.  However, it got me wondering about how one might modify
it to make the following work ...

	A, B, C, D, E = enum(5)

or, if one wanted to specify a starting value, something like ...

	A, B, C, D, E = enum(5, 123)

Logically, this can be done, since you can return multiple values. The
problem is, how does one set up a dynamic set of return values?  Ie,
while I can do something like this ...

	def threeEnums
 		return 1, 2, 3
	end

and then use it to initialise A, B and C via

	A, B, C = threeEnums

how can I set up the return value if I want to be able to specify how
many things to return at runtime?

I'm sure there must be a way.  In my experience, Ruby can do
absolutely anything :-) !!