It can be handy to have a set of related constants. Without type checking or overloading, having the compiler know they are related is not particularly important.
Under Perl 6, we are getting more typing, right? So this might be more interesting.
Also, we can program uses for having them related, such as formatting and reverse-lookup. That is, print "Red" instead of 100 if that's part of a Color enumeration.
—John
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Enumerations
by perrin (Chancellor) on Dec 17, 2001 at 23:41 UTC | |
|
Re: Enumerations
by hakkr (Chaplain) on Dec 17, 2001 at 22:34 UTC |