I created this thread because I wanted to discuss a main concern of mine: what should happen when getting the TYPEOF a generic field? As the structs evolved I figured I wanted to include generic fields---fields which can contain any datatype (int, float, or string.) The inspiration came from Java; unlike Java, however, the types don't need to be defined at declaration time and it isn't a compiler feature. The nature of these structs allows these fields to maintain any data type at any given time. To provide an example:
@STRUCT_GENERIC DATA "GENERIC","FIELD" DATA "END"This declares a struct type GENERIC with a generic-type field named FIELD. When this struct is instanced, you don't need to provide a type; the standard procedure for declaration holds true. At first, the field simply has no type defined besides "generic.' Let's say you set it to an int, for example:
'here STRC contains a GENERIC struct SET STRC,"FIELD",1The field will now contain information stating that it's generic, but also keeps a data type of int inside. If we tried to set the field to a string it would work. The type of the generic field just depends on what data type it's storing. It can store any type at any time. Since we have information that the field is both generic and what data type it holds, what is returned when we do TYPEOF(STRC,"FIELD")? I wanted to ask what you guys would find useful.
- Return just the type of the data inside the field.
- Return just "GENERIC".
- Return some mixture of both.