John,
The gist of Peter's suggestion is to use
memcpy() available in the C runtime (and every MS Windows kernelXX.dll too) to copy an array's entire contents to another array in one go rather than atomizing the process into indiviadual element assignments.
memcpy()-ing will do it much, much faster.
However, such a trick will only work with C-compliant arrays.
memcpy() expects the array elements to strictly follow one another in the process memory and accepts a total number of bytes to copy as its last argument.
According to
ScriptBasic's User Guide, arrays that
you're calling "standard" and "associative" are implemented as arrays of poniters or perhaps even as linked lists with elements allocated at random locations in the process memory. Such arrays are not C- or WinAPI-compliant though they will serve their purpose perfectly well when used in native language statements.
For the same reason, your emulation of user-defined Types and/or Unions will only work with the language's standard vocabulary. You won't be able to use such structures in a call to third-party code.
FBSL's
Types and
Unions have controllable alignment and are strictly C-compliant. FBSL's strong-typed
static arrays (a.k.a. fixed-size arrays) are C-compliant too. FBSL's
Variant arrays and
anonymous arrays (a.k.a. unnamed arrays) are C-compliant with each element being 16 bytes long (that's the length of one FBSL Variant structure which is also
COM-compatible). FBSL's
dynamic arrays (a.k.a. growable arrays) are implemented as doubly-linked lists and are therefore not C-compliant.
FBSL has also a native
MemMove() function that ensures correct bit block copy even within overlapping memory areas.