[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] OrderedSet (was Re: environment/shared pool search orde

From: Stephen Compall
Subject: [Help-smalltalk] OrderedSet (was Re: environment/shared pool search order?)
Date: Fri, 13 Apr 2007 15:08:53 -0500

On Tue, 2007-04-10 at 08:06 +0200, Paolo Bonzini wrote:
> 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.

Since I wrote OrderedSet for the core as a subclass of
OrderedCollection, I thought I might ask what specifically would be more

1. An OrderedCollection that does not allow two "equal" elements
(at:put: fails if element is already present and not at that position,
add: ignores argument if already present).

2. A <Set> that remembers the order in which elements were added (the
OrderedCollection protocols missing from Set are self

The difference is that the attached follows 1 and supports all of
OrderedCollection's operations (forgive the usingSet: nonsense that is
just there until I come up with something better).  After writing them,
I thought that maybe they should not be supported at all (except for the
index = collection size case).

;;; Stephen Compall ** **
Failure to imagine vast possibilities usually stems from a lack of
imagination, not a lack of possibility.

Description: Text document

Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]