Structures
- Posted by Mathew Hounsell <mat.hounsell at MAILEXCITE.COM> Apr 24, 1998
- 520 views
Wash your mouths out with soap people. Let us be honest, the thought of changing Euphoria probablely brings ROB out, at least, in a cold sweat, after all it was his thesis. So... Rob doesn't want to hange Euphoria. The sequence and lack of a million and one data types is what makes Euphoria sim ple. Type is what makes Euphoria more powerful. Thus an extention of type would increases Euphorias power, and possiblely it's e ffiency, and wouldn't send Rob into fits. It should be simple. I have two suggestions: length is/of i elements are (atoms/integers/objects/sequences) length would cause a type check failure if you wanted to exceded it and elements would cause a type check failure if you tried to set a different type to the seq uence. That above option could then be used in the following, hardered to implemement s uggestion... _The complex Data Type_ It would basically be a C structure of your design, but maybe with the possibili ty to use sequences. See the previous ideas have suggested that you define a struct ure, but a structure doesn't fit within the context of the atom being the base data t ype and the sequence being a thing to put lots of them in. type description( sequence s ) elements are integers length is 256 return 1 end type type menu_str( sequence s ) elements are integeres length is 16 return 1 end type -- because menu str is always 16 ints mem can be -- pre-assigned complex menu_item ( sequence s) format { menu_str, integer, string, integer } return 1 end complex I suggested implementing a length keyword rather than using : type six_elmnt_seq( sequence s) return length(s) = 6 end type as it could pre-allocate memory for the type if it had a fixed element type. The re is one suggestion of a data type iplemented only in complex and that is byte to save space, when all we want is a string. It would save error detection coding. ( My Aborted HTML help system got bogged d own in that. ----- Sincerely, Mathew Hounsell Mat.Hounsell at mailexcite.com "Death to the semi-colon" Compiler Errors: Line 1 : End of line reached without semi-colon (;) Line 2 : End of line reached without semi-colon (;) etc Free web-based email, Forever, From anywhere! http://www.mailexcite.com