Re: Enumeration data type

"Kevin Szabo" <>
19 Jan 2001 23:21:57 -0500

          From comp.compilers

Related articles
Enumeration data type (Brian Webb) (2001-01-18)
Re: Enumeration data type (Brian Webb) (2001-01-19)
Re: Enumeration data type (Tim Van Holder) (2001-01-19)
Re: Enumeration data type (Kevin Szabo) (2001-01-19)
Re: Enumeration data type (Mike Dimmick) (2001-01-19)
| List of all articles for this month |

From: "Kevin Szabo" <>
Newsgroups: comp.compilers
Date: 19 Jan 2001 23:21:57 -0500
Organization: Nortel Networks (Ottawa, Ontario, Canada)
References: 01-01-081
Keywords: types
Posted-Date: 19 Jan 2001 23:21:57 EST
Originator: (Kevin Szabo)
X-Orig: <>

Brian Webb <> 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
>following constructs.

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.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.