|Enumeration data type firstname.lastname@example.org (Brian Webb) (2001-01-18)|
|Re: Enumeration data type iRobot@swbell.net (Brian Webb) (2001-01-19)|
|Re: Enumeration data type email@example.com (Tim Van Holder) (2001-01-19)|
|Re: Enumeration data type firstname.lastname@example.org (Kevin Szabo) (2001-01-19)|
|Re: Enumeration data type email@example.com (Mike Dimmick) (2001-01-19)|
|From:||"Kevin Szabo" <firstname.lastname@example.org>|
|Date:||19 Jan 2001 23:21:57 -0500|
|Organization:||Nortel Networks (Ottawa, Ontario, Canada)|
|Posted-Date:||19 Jan 2001 23:21:57 EST|
|Originator:||email@example.com (Kevin Szabo)|
Brian Webb <firstname.lastname@example.org> wrote:
>I'm planning on adding the ability to create "sets of typed constants"
>to a language that I'm designing, but feel that using the term
>"enumeration" may be confusing. What's a good name to use for the
Finding a good name is imperative, since I find that naming is (for
me) the essence of a good design. If I can't name it, then the
concept/role is muddled.
So, for your example you called it a set of typed constants, but I
think that was not completely correct. I think you meant 'sets of
named constants'. Things to think about is how these are used, for
example are they included (and searched) like a namespace when you are
trying to resolve symbols in your language. Is the order preserved?
Can you interate over them (successor, predecessor operations?)
The smalltalk language contains something like what I think you want.
It is called a 'Pool' or 'PoolDictionary'. Essentially they are a
dictionary (aka MAP in C++ STL) of name-value pairs (Associations)
where the value is assumed to be constant. When you define a class in
the Smalltalk language you include a list of 'pools' that are searched
when symbols are resolved, thus providing a bucket of constants that
are not in the global scope.
I personally didn't care much for pool variables; I prefered creating
a class that provided a method (function) that would return the
constant. Provided all the utility of pools without adding another
(low value) concept to the language.
Return to the
Search the comp.compilers archives again.