Fwd: Persisting IdentityDictionary

Elliot Finley efinley.lists at gmail.com
Wed Apr 27 17:25:12 UTC 2011


Oops, forgot to reply-all to get it to the list.  Here it is.

On Tue, Apr 26, 2011 at 8:39 PM, Chris Muller <ma.chris.m at gmail.com> wrote:
>> You're using 'self keyHash: key' to find a specific bucket that should
>> contain that object.  But 'self keyHash: key' may (and probably will)
>> answer a different number for the same object each time it is
>> materialized from the database unless it is somehow using the MagmaOID
>> in place of the identityHash.
>
> Right, you definitely cannot use Squeak's #identityHash in the equation.
>
> Hm, let me about this a few days, I think an easy solution will appear..

maybe:

use magmaOid as keyHash.

when finding a key (#at), check if key has magmaOid first, if not,
'self errorKeyNotFound: key' because it doesn't exist in
IdentityDictionary anyway.

when storing a value (#at: put:); before finding its bucket, check if
key has magmaOid, if not, store key in database so it will have a
magmaOid.  I'm not sure what the code looks like on this last one, but
it sounds good :)


More information about the Magma mailing list