Hi Sava :-)
You're welcome!
The dynamic/fixed-size array thing works something like this. When I said "fixed" I probably should have said "static", since that's where the difference really is.
If you do this:
char str[5]
...Dana is going to pre-allocate this array for you. You can then assign its various indices directly, without first having to do a new(). The array is always going to be of length 5.
If you do this:
char str[]
...Dana will not pre-allocate this array and you're going to need to do an = new char[]() kind of thing at some point. This str variable can point to any array length, and can point at different arrays over time.
I think this makes sense if you're coming from C, which has a similar concept of static vs dynamic arrays.
I guess there are other uses for statically-defined arrays, but for me the neat thing about them is network data serialisation. If we do something like this:
data Packet {
int8 type
byte kload[16]
int8 flags
}...Dana can directly serialise this into bytes, like:
Packet p = new Packet()
byte stream[] = dana.serial(p)
The length of the stream array here is exactly 32 bytes (it's the raw data of the packet). This is really useful when you're working with low-level network protocols which specify particular packet formats. I can't think of another high-level language that can do this kind of low-level data framing so concisely :)
jess
[edited by forum mods to fix a username association error, thanks]