diff --git a/vector-space.md b/vector-space.md index 5450f59..e649e21 100644 --- a/vector-space.md +++ b/vector-space.md @@ -51,4 +51,12 @@ We definitely need chunks of executable code - compiled functions. ### HASH -We definitely need hashtables, to implement namespaces, regularities and so on. A hashtable is implemented as a pointer to a hashing function, and an array of N cons-pointers each of which points to an [[association list]] acting as a hash bucket. \ No newline at end of file +We definitely need hashtables. A hashtable is implemented as a pointer to a hashing function, and an array of N cons-pointers each of which points to an [[assoc list]] acting as a hash bucket. A hashtable is immutable. Any function which 'adds a new key/value pair to' a hashtable in fact returns a new hashtable containing all the key value bindings from the old one, with the new one added. Any function which 'changes a key/value pair' in a hashtable in fact returns a new value with the same bindings of all the keys except the one which has changed as the old one. + +In either case, anything which held a pointer to the old version still sees the old version, which continues to exist until everything which pointed to it has been deallocated. Only things which access the hashtable via a binding in a current namespace will see the new version. + +### NMSP + +A namespace. A namespace is a hashtable with some extra features. It has a parent pointer: NIL in the case of a namespace which was not created by 'adding to' or 'modifying' a pre-existing one, but where a pre-existing one was acted on, then that pre-existing one. It also must have an additional access control list, for users entitled to create new canonical versions of this namespace. + +A lot of thinking needs to be done here. It's tricky. If I get it wrong, the cost to either performance or security or both will be horrible. \ No newline at end of file