Re: sequence OF what? - structores
- Posted by "Unkmar" <L3Euphoria at bellsouth.net> Jun 04, 2004
- 476 views
http://www.listfilter.com/cgi-bin/esearch.exu?keywords=%22end+struct%22 I Looked back through some of that history of structure suggestions.
type char(object x) if (integer(x) and (255 >= x and x >= 0) then result 1 else result 0 end if end type
char my_string[] my_string = "Hello" my_string = {-1, 45} -- error because -1 isn't a char stuct Address street as char[40] city as char[30] state as char[2] zip as char[5] end struct OR stucture Address street as char(40) city as char(30) state as char(2) zip as char(5) end structure Just take a look at the link I supplied. It shows that this subject as been beat to death before. And this link displays Rob's view on structures and some of what we have been asking for. http://www.listfilter.com/cgi-bin/esearch.exu?postedBy=Craig&keywords=struct ures I'll shut up now unkmar ----- Original Message ----- From: "Patrick Barnes" <mistertrik at hotmail.com> To: <EUforum at topica.com> Sent: Thursday, June 03, 2004 10:00 PM Subject: RE: sequence OF what? - structores >From: Lucius Hilley <l3euphoria at bellsouth.net> >Subject: sequence OF what? - structores >Only thing I can figure you can get out of that is. >Very fixed, non-dynamic typing. >I know, you say, What? Actually, I know what you mean. It's supposed to be fixed. Most of the variables we use will be aggregates, long sequences containing lots of the same type of value. Unfortunately, at the moment traditional type checking is horribly slow. A 2 element sequence wouldn't take long, but to check a 1000-element sequence is too slow, cause traditional type checking has to check every single element every time something changes. I don't mean for the 'of' keyword to be appropriate for structures, that is a separate issue, and totally transparent to the idea of "of". >Using OF how would you type handle this? >}}} <eucode> >sequence pb > >pb = {"Johnny", "Robert", "Princeton", "Jr.", 12, 31, 1977, 150, "blue", >"blonde", 6, 2, 'M'} ></eucode> {{{ As I said above, "of" doesn't affect structures at all. For an individual element comprised of different types of values, a traditional type check would need to be used. However, for the sequence comprised of these structures:
type PhoneBookItem( sequence s ) ... normal type checking, make sure that each value is ok ... end type type addressbook (sequence of PhoneBookItem s) return 1 end type addressbook directory directory = {} directory &= {pb}
>---- >I stand by my proposal... or should I say Chris Bensler's proposal of >structures. >Maybe, someone mentioned before him. I wouldn't doubt it. Either way. >Something like this can handle it. <SNIP> >}}} <eucode> >struct PhoneBookItem > {string, string, string, string, month, mday, year, string, string, >feet, >inches, gender} >end struct ></eucode> {{{ As you said, you don't know what to do with strings :oP I don't know exactly what the best thing to do is regarding structures, but if they become a type, then they can be used by the "of" system. No problem. I don't mean to add anything new to the language as far as language enhancements. The thing that "of" does, and the only thing that of does, is allow user defined types to be USEFUL for anything other than simple things. MrTrick