Stephen Compall wrote:
STSymbolTable uses an IdentitySet to store pool dictionaries and
environments. This is fine ordinarily, but loses the search order
imposed by find_class_variable in sym.c. Perhaps what is needed is the
semantics of an "ordered identity set"?
That's right. The simplest way to implement such a thing is
to subclass IdentitySet, adding something like
initialize: size
super initialize: size.
orderedCollection := OrderedCollection new: size.
remove: anObject ifAbsent: aBlock
self shouldNotImplement
primAt: anIndex put: anObject
orderedCollection addLast: anObject
do: aBlock
orderedCollection do: aBlock
The best way to do so would be the other way round:
subclass OrderedCollection, wrapping all the "add" methods
with a test for inclusion (using the hashed collection),
and redefining #includes: so that it uses the hashed
collection. This would have the advantage that you
could use the same class for both OrderedSet and
OrderedIdentitySet.
Either choice is fine with me.
Paolo
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk