From: Jim Menard Date: 2005-08-03T01:49:43+09:00 Subject: Re: enum collection of constant values Pit Capitain wrote: > Jim Menard schrieb: >>Use symbols. They are similar to strings, but every use of the same >>symbol uses the same value, and they are very compact. >> >>state = :none >>state = :good if all_is_well >># ... >>state = :logic_error > > > ... and for a set of values use the class Set. I'm not sure I understand why you suggest the use of Set. Am I missing an advantage over the user of symbols? The original poster was looking for the Ruby equivalent of C's enums, which are essentially a group of named constants. A Set---as implemented in Set.rb---contains a Hash whose keys are the elements of the set. Though this would work as intended, it is more work and overhead than necessary. The OP wanted something that was "preferably compact". Jim -- Jim Menard, jimm@io.com, http://www.io.com/~jimm "A language that doesn't affect the way you think about programming, is not worth knowing." -- Alan J. Perlis