Re: Structures (WAS Re: Memory)
- Posted by Quality <quality at ANNEX.COM> Jan 10, 1999
- 543 views
One implementation suggestion would be to create an ALIAS function that would allow struct like tags to access common sequences. -----Original Message----- From: Cox Family <cox.family at SK.SYMPATICO.CA> To: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU> Date: Sunday, January 10, 1999 11:26 AM Subject: Structures (WAS Re: Memory) >Dear Euphorians, > >Irv Mullins explained: > >> >And while I'm at it, can anyone tell me specifically what the term >> >'structure' means ? Example; is it related to code or data? Please >> >convert your answear to my 2-digit IQ format >> >> Both. A structure is a way to "package" variables so they can be >> handled more conveniently. >> Example in unEuphoria code: >> structure customer >> sequence name, addr, city, state, zip, phone >> integer age >> end structure >> >> You could make assignments as follows: >> customer.name = "John Smith" >> customer.phone = "555-1212" >> customer.age = 23 >> and write to disk as puts(fn, customer) >> or assign the whole thing in one swell foop: thiscustomer = customer >> which does the same as: >> thiscustomer.name = customer.name >> thiscustomer.addr = customer.addr >> thiscustomer.city = customer.city...and so on. > >As Irv pointed out, structures are a way of conveniently handling >variables. I was surprised when I started learning Euphoria (I still >am ) that I couldn't find a structure (or struct, or TYPE, depending >on your background) statement in Euphoria. I would be in favour >of implementing this into a later Euphoria version, if possible. IMO, it >doesn't 'dirty up' the code by making it too complex, but rather >(like stated above) gives the programmer one more way of handling >variables, and a clean, clear way of doing it at that. Any opinions on this? > > >Chris Cox >cox.family at sk.sympatico.ca