[Info-vax] DEC Basic and dynamic memory ?
Stephen Hoffman
seaohveh at hoffmanlabs.invalid
Sat Jan 29 11:57:17 EST 2022
On 2022-01-28 19:57:26 +0000, Simon Clubley said:
> How easy is it in DEC Basic to build a tree of (say) 1000 nodes of a
> custom data structure in dynamic memory and then walk the tree either
> depth-first or breadth-first ?
MAP DYNAMIC and REMAP are the operators you're looking for, for the
approach you're envisioning.
Maybe involving the LIBRTL tree routines.
It's a slog. Lots of glue code. But it's workable.
Pragmatically, more than a few BASIC apps store will dynamic data
structures in key-value or other persistent file storage.
Not that I've met many BASIC apps that have used red-black or other trees.
With SSDs et al, the performance penalty for (misusing?) persistent
storage is much lower.
Without language support for pointers (for the ugly approach) and
without object support (for the cleaner approach), BASIC dynamic memory
data structures get clunky.
Moderate- and larger-sized apps necessarily also become multiple
sub-two-tebibyte storage chunks too, with all the "fun" that entails.
BASIC is a ripe target for 64-bit addressing and for the addition of
object support, as I've commented before.
With that, the binary tree can be implemented within the object
run-time (once, not everywhere), and the developer can (largely) ignore
the tree implementation details.
--
Pure Personal Opinion | HoffmanLabs LLC
More information about the Info-vax
mailing list