Menu

#3 extended typing system.

open
nobody
None
5
2002-12-14
2002-12-14
jbrown
No

We can add to the current type system of:

integer, atom, object, sequence

with these types:

byte, string, shortint (16-bit), longint (64-bit), float (32-bit),
and longatom (128-bit).

Furthermore, I propose that the integer type be extended to 32-bits,
rather than just 31-bits.

Also, we should allow static arrays of the following types (other than
object and sequence perhaps, for those 2 types there is no point. On
the other hand perhaps it should be allowed for consistency).

It would look like this:

byte barray[10] --slicable from 1..10, like a sequence, only it takes up
--around sizeof(byte)*10 internally.

string strarray[15] --string array, 15 elements.

Dynamic arrays should be added as well.
Perhaps a redim statement could handle this?

redim barray as size 18 --as if we declared "byte barray[18]" in the first place.

Finally, I also propose the following structure for struct/records
support:

struct <name>
<type1> <name1>
<type2> <name2>
<type3> <name3>
....
end struct

for example:

struct test
object x
float y
end struct

or even:

struct foo
struct test bar[10]
string list[18]
end struct

Arrays within a struct should be redimable, if dynamic arrays are supported.

Ex:

struct foo sf
redim sf.list as size 100 --this changes the list member of sf

Discussion

MongoDB Logo MongoDB