Enumeration data type

Brian Webb <irobot@swbell.net>
18 Jan 2001 01:04:01 -0500

          From comp.compilers

Related articles
Enumeration data type irobot@swbell.net (Brian Webb) (2001-01-18)
Re: Enumeration data type iRobot@swbell.net (Brian Webb) (2001-01-19)
Re: Enumeration data type tim.vanholder@falconsoft.be (Tim Van Holder) (2001-01-19)
Re: Enumeration data type kszabo@nortelnetworks.com (Kevin Szabo) (2001-01-19)
Re: Enumeration data type mike@dimmick.demon.co.uk (Mike Dimmick) (2001-01-19)
| List of all articles for this month |
From: Brian Webb <irobot@swbell.net>
Newsgroups: comp.compilers
Date: 18 Jan 2001 01:04:01 -0500
Organization: Compilers Central
Keywords: types, question, comment
Posted-Date: 18 Jan 2001 01:04:00 EST

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
    Green = 2
    Blue = 8
    White = 16
end enumeration Color_Code


enumeration Probability is real
    None = 0.0
    Low = 0.1
    Medium = 0.5
    High = 0.9
    All = 1.0
end enumeration Fuzziness


enumeration Elements is Element
    Hydrogen = (Element) ("H", 1, 1.0079)
    Deuterium = (Element) ("H", 1, 2.0000)
    Helium = (Element) ("He", 2, 4.0026)
    Helium3 = (Element) ("He", 2, 3.0000)
    Helium4 = (Element) ("He", 2, 4.0000)
    Lithium = (Element) ("Li", 3, 6.9410)
    Beryllium = (Element) ("Be", 4, 9.0122)
    etc...
end enumeration


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.


Thanks,


- Brian
[I don't understand whether these are supposed to be constant arrays,
sets of named constants, or something else. -John]


Post a followup to this message

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