Hello all, I have re-submitted my pull request with the following changes:
1. Get_Key and Get_Value now throw errors when they are called before iteration has started or after iteration has ended. 2. Get_Key checks for the Tombstone and throws an error since this only occurs if the hash has been modified during iteration. 3. Get_Value has been updated to be nullable. Notably, I have left the HashIterator code inside separate source files, rather than moving it into Hash. I felt that without a strong consensus it made more sense to leave as is and update later if that's the pattern we decide on. Tim On Mon, Sep 1, 2014 at 10:43 AM, Nick Wellnhofer <[email protected]> wrote: > On Sep 1, 2014, at 19:27 , Marvin Humphrey <[email protected]> wrote: > > There's also knowing what header file corresponds to a given public > class, > > since Clownfish does not at present impose any restriction on where > classes > > may be defined. > > I don’t want to lose the ability to share a .c file for multiple classes. > We could simply have multiple .cfh files and the implementation in a single > .c file. But this might be confusing. > > > A related bug is that we do not enforce that Hash keys must be immutable. > > > > Hash *hash = Hash_new(0); > > ByteBuf *foo = BB_new_bytes("foo", 4) > > Hash_Store(hash, (Obj*)foo, NULL); > > VArray *keys = Hash_Keys(hash); > > ByteBuf *key = (ByteBuf*)VA_Fetch(keys, 0); > > BB_Set_Size(key, 2); // Uh oh. > > > > There's a straightforward solution, though. 99% of the time, Hash uses > only > > String keys. String is immutable. We should consider requiring Hash > keys to > > be Strings. There are a lot of advantages, and few downsides. > > Or we clone the returned keys like we clone them in Hash_Make_Key. > > Nick > >
