Re: enum suggestion
- Posted by mattlewis (admin) Feb 24, 2011
- 1312 views
irv said...
An interesting version in another language:
enum field as name, addr, city, state
Used as in Euphoria, as a substitute for structures, but also 'reversible', so that field[1] returns 'name'.
This has some uses.
Yes, I like that. It should be pretty easy to implement, too.
You'd basically end up with a constant named field, so that your code would be equivalent to:
constant field = {"name", "addr", "city", "state"} enum name, addr, city, state
Although that sort of implementation wouldn't work as well for sparse or non-integral enums.
Matt