Regretfully they are, Charles. String data such as
SYMBOLs (keywords, names and literals) are stored in a hash table while numeric data is stored in variant arrays (QB/SB/FBSL). The "registers" and temporary variables that store and access this data are all variant-based too, and they also serve the needs of creating, replenishing and accessing the hash table at the same time.
I cannot avoid anonymizing the heap arrays because the setup uses heap "page" swapping (two separate arrays corresponding to two "pages" of heap memory). Swapping occurs in the garbage collection cycle. It was initially implemented in QB45 as a two-dimensional variant array with its second dimension being "pages" 0 and 1, respectively. "Page" swapping was organized by swapping the values 0 and 1 in the indexer variables ACTIVE and PASSIVE.
On splitting the arrays, the only option I was left with was swapping distinct array pointers rather than the second dimension indexers. That was achieved by direct
SWAP(active_array, passive_array)
in FBSL, and by somewhat more elaborate
ref vars in SB:
REF active_array = array0
REF passive_array = array1
SWAP active_array, passive_array
Now you've helped me determine the most efficient way to do the same in OxyLISP but it doesn't withdraw the issue with strong data typification of the arrays from the agenda.
Hence my suggestion to move over to doubles. Once the arrays
and their overlays are strong typed to
double, I can still use their values for hardcoded hash table access through appropriate type casts to
ints of various sizes. But I can't still foretell exactly what data type a temporary variable would have when it is supposed to go into a "register", or heap location, or stack location. I have to keep track of current data type in every temp var and use appropriate casts. I am also supposed to build a hellish IF/THEN/ELSE tree in almost every other statement to evaluate for possible data types in each "register", heap, and stack location.
This is provided for free under the hood in SB and FBSL but it would be hardly worth the effort in OxyLISP which is nothing but a toy yet, exactly like its variant-based interpretative siblings.
This is why my vote is for doubles only.
BTW not only is this GOSUB/RETURN/RET trickery very unattractive as it is but it would also be even more ugly to re-work into SUB/RETURNs. Three quarters of the existing labels are referred to with both GOTO and GOSUB. Go figure how to deinterlace all this mess when you're nearing your sixties and doubting whether it's all worth the effort ...