Lisp Signatures...
FWIW... I just finished another example of using these protocol specs, for both in-memory and external persistent extensible hash-tables. An extensible hash table is one that automatically grows to accommodate increasing occupancy. It uses variable bit-length hash values computed from keys. This is quite unlike open hashing, nor like chained hashing as we find implemented in Lisp.But the protocol allowed me to debug the working code for get-hash, (setf get-hash), delete-hash, map-hash, against an in-memory version in just about 2 hours of expended labor from start to finish. Then once I was sure the in-memory version worked correctly, it took about 1 hour to get the external persistent version working.
Component protocols, as in B-Trees were for components known as HashTable and HashTable-Bucket. The higher level code just assumed things about these two kinds of storage receptacles, like the ability to store keys in a bucket, and to find buckets from hashed key indexing into hash-table bins -- whatever those two things really are... They only have to behave externally in a specified manner. What they actually do, and how they do it, is of no concern to the get-hash, (setf get-hash), etc., code.
The only change to the code for external persistent hash-tables was an augmentation resulting from cooking up the implementation of the component protocol for persistent storage, to parallel that of the in-memory version. The actual get-hash, (setf get-hash), delete-hash, and map-hash code remained completely common, and fully debugged, to both versions.
This is a really nice way to work, without having to stand on your head attempting to force subclass relationships between wildly different beasts.
Dr. David McClain
Chief Technical Officer
Refined Audiometrics Laboratory
4391 N. Camino Ferreo
Tucson, AZ 85750
email: dbm@refined-audiometrics.com
phone: 1.520.390.3995