Re: ADA to EUPHORIA
- Posted by SDPringle Jul 31, 2014
- 1969 views
Hello Derek,
Enumerated values in the language itself are not considered integers. Whereas in say EUPHORIA or C+ + they are. I have never written Ada myself but I point to the example at:
http://en.wikibooks.org/wiki/Ada_Programming/Types/Enumeration
type Primary_Color is (Red, Green, Blue);
Speaking as if we talk about in ADA, if I am not mistaken the expression like 'Red + Blue' will simply not compile. They may be implemented as 1 and 2 but the language above it just says no when you want to add them together. If you could add them or multiply them, you could say that 'Primary_Color' type acts as though it is a subclass (python style) of int. If you defined Primary_Color as a subclass of int, you could certainly define three constants Blue, Red, Green and then you could add them together.
Contrast this with C, C+ +, EUPHORIA.
type enum Primary_Color Red, Green, Blue end type
In most languages these are just integers. So you can do arithmetic on them.