[squeak-dev] Ephemerons and Dictionaries

Eliot Miranda eliot.miranda at gmail.com
Thu Oct 1 17:44:46 UTC 2020


Hi All,

    to be able to ease EphemeronDicitonary into the system easily I'd like
to clean up adding associations to Dictionary.  It seems to me there's a
partial implementation of choosing an association class appropriate for a
dictionary in the implementors of
associationClass: Dictionary>>#associationClass,
WeakKeyDictionary>>#associationClass,
WeakValueDictionary>>#associationClass,
(& in my image STON class>>#associationClass).  This seems workable; an
EphemeronDictionary would simply add associationClass ^ Ephemeron and we're
done, except not quite...

First, HashedCollection does not use associationClass, but it implements
atNewIndex:put: and it strikes me that atNewIndex:put: for Dictionary
really should check for the thing being added at least includingBehavior:
self associationClass.  So that means Dictionary should override
atNewIndex:put:.

But what should happen in atNewIndex:put: if the object being added isn't
appropriate?  Do we
- raise an error? (that's my preference, but I've got limited use cases in
my head)
- replace the association with one of assocationClass? (seems dangerous to
me but maybe someone needs this or the existing system does this anyway)
- ignore it and hope the user knows what they're doing?



_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201001/14e6459b/attachment.html>


More information about the Squeak-dev mailing list