[% setvar title unified container theory %]
|Note: these documents may be out of date. Do not use as reference!|
To see what is currently happening visit http://www.perl6.org/
unified container theory
Maintainer: David Nicol <email@example.com> Date: 28 Sep 2000 Mailing List: firstname.lastname@example.org Number: 341 Version: 1 Status: Developing
Viewing Hash and Array as instances of "Container" leads to easy implementation of "Sparse Array" and "Sorted Hash" and "Real Array"
There are two big differences between Hash and Array.
Hash keys are string, and Array keys are Integer
Array semantics include listing keys which have not been assigned to yet. This is really an issue for the accessing functions, not the underlying data.
maybe square brackets as the
qr delimiter would be a good way to
indicate RFC197 regex semantics. Wouldn't that make for an easy way to take
a slice from a collection of data points?
With this in mind, it becomes possible to consider implementing both container types as sorted trees, possibly transparently switching to block offset arrays when Array is sufficiently dense.
The one tree framework could be used for both types of trees, by switching the comparison function.
Tree search may be faster than hash function calculation for easily compared data.
The above is written from memory of conversation in August on perl6-internals.