Re: named array

new topic     » goto parent     » topic index » view thread      » older message » newer message
SDPringle said...
enum 
	CITIZEN_FIRST,  
	CITIZEN_LAST,  
	CITIZEN_INCOME  
  
enum  
	SUPERHERO_FIRST,  
	SUPERHERO_LAST,  
	SUPERHERO_TASK  
  

This kind of thing makes the accessing much faster than using find with a string. It is easy to write in EUPHORIA:

sequence stephen_hawking = { "Stephen", "Hawking", 120_000 } 

The problem is the code requires the coder to know how the structure members are ordered. The above line breaks 'data encapsulation'. Really you want to combine these with a function struct_assign:

sequence stephen_hawking = struct_assign({ CITIZEN_FIRST, "Stephen",  
                                            CITIZEN_LAST, "Hawking",  
                                          CITIZEN_INCOME, 120_000 }) 

The implementation of struct_assign is an exercise for the reader. :) Remember to replace 'sequence' with your own user defined type to save you from blunders.

Looks like an xml data table.

useless

PS: if what the OP wants is a free-form xml table, i wrote such an interface in Eu in a version of strtok: getxml(). I removed it later because of criticism that it wasn't needed and wasn't the "Euphoria way".

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

Search



Quick Links

User menu

Not signed in.

Misc Menu