Re: enum suggestion

new topic     » goto parent     » topic index » view thread      » older message » newer message
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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu