Case-logic/enumerated types

lex at cc.gatech.edu lex at cc.gatech.edu
Thu Oct 28 17:47:45 UTC 2004


Blake <blake at kingdomrpg.com> wrote:
> 	Along similar lines, Meyer expressed disapproval for enumerated types,  
> yet they're one of the few things I consistently miss (in languages that  
> are not Pascal<s>). It still seems like it would be a useful thing to be  
> able to describe a sequence of values--particularly specific to a class  
> (which has always been the problem with Pascal enums)--and even named  
> constants.

An issue with enumerated types is that they are hard to extend.  What if
you make a subclass, and want to have an extra choice available in the
enumerated type?  With raw symbols this is fine.  With class-per-state
this is fine.  But with a Pascal-like or C-like (or ML-like!) enumerated
type, you can only extend it by editing the original definition.

<shameless plug>
Chuck is good at finding all the symbols that are available in an
enumerated type.  Point to a variable which holds the Squeak equivelant
of an enumerated type, and, if Chuck can figure out what the code is
doing, the type of that variable will be the list of possible symbols. 
Given that such tools are possible, it seems less important that the
programmer maintain an explicit list of options anywhere.
</shameless plug>


-Lex



More information about the Squeak-dev mailing list