|Enumeration data type email@example.com (Brian Webb) (2001-01-18)|
|Re: Enumeration data type iRobot@swbell.net (Brian Webb) (2001-01-19)|
|Re: Enumeration data type firstname.lastname@example.org (Tim Van Holder) (2001-01-19)|
|Re: Enumeration data type email@example.com (Kevin Szabo) (2001-01-19)|
|Re: Enumeration data type firstname.lastname@example.org (Mike Dimmick) (2001-01-19)|
|From:||"Mike Dimmick" <email@example.com>|
|Date:||19 Jan 2001 23:23:22 -0500|
|Posted-Date:||19 Jan 2001 23:23:22 EST|
"Brian Webb" <firstname.lastname@example.org> wrote in message
> 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.
> They're like enumerations, except that values may be assigned and data
> types other than integer can be used.
> enumeration Color_Code is integer
> Black = 0
> Red = 1
> enumeration Probability is real
> None = 0.0
> Low = 0.1
> enumeration Elements is Element
> Hydrogen = (Element) ("H", 1, 1.0079)
> Deuterium = (Element) ("H", 1, 2.0000)
> constant set of Elements Inert is (Helium, Neon)
> Any thoughts on a good terminology for these items. Don't read
> anything into the sample data, it's purely made up.
Ada divides the concepts into two; you can specify an enumeration:
TYPE Color_Code IS (Black, Red, Green, Blue, White);
then specify which values you want used for the members of the enumeration:
FOR Color_Code USE (
Black => 0,
Red => 1,
Green => 2,
Blue => 8,
White => 16
I don't know if this helps you at all. There's an online reference
manual (I think it can be found somewhere on www.adapower.com); the
relevant sections are 3.5.1 (Enumeration Types) and 13.4 (Enumeration
Return to the
Search the comp.compilers archives again.