[Newbies] enumerated types
mark at ociweb.com
Mon Oct 6 01:48:19 UTC 2008
On Oct 5, 2008, at 8:38 PM, Michael van der Gulik wrote:
> On Mon, Oct 6, 2008 at 2:19 PM, Mark Volkmann <mark at ociweb.com> wrote:
> Have I summarized this correctly?
> Smalltalk doesn't support the concept of enumerated types like in
> Java 5 and above. Instead, the Smalltalk way is to:
> What are you using enums for? I've never found I've needed them,
> often because the need for them can be refactored away and you end
> up with cleaner code.
> Often I just use symbols (i.e. #red, #blue, #green). These are
> generic descriptive names for thingies.
I haven't used them yet in Smalltalk, but I'm thinking I'll have a
need to verify that a value passed to a method is a member of a
confined set. Maybe I should just test a symbol passed as an argument
to a method to see if it's in an array of allowed symbols.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners