Delphi's collection types and their inheritance structure can drive 
you crazy, however the problem Jeremy is having is caused by the fact 
that a "Collection" should not have an order : a collection with an 
"sort" property is a list. However the Delphi implementation is pretty 
darn bad: a TCollection uses a TList (for the sake of implementation), 
which gives this :

TList = (collection with sort)
TCollection = ((collection with sort), and hide the sort)

And then a whole lot of other functionality is added to a TCollection,
so that when you need a certain type of collection, a TCollection is the
best choice.

Neven MacEwan wrote:
> 
> Paul
> 
> Back to the start of this thread (sort of) does anyone elso out there think
> Delphi (Object Pascal?)
> could do with a SetOf base type (having just defined my nth collection type)

I would like to see this:
TCollection = (any old bunch of objects)
TList = TCollection + Sort
TSet  = TCollection + (only one of each object)
and then anyone can define as many subclasses as they want 
(eg: TTable = TCollection + (all objects have a unique key)) 
without banging into a "half overlap" with what is provided by Delphi.

> 
> ie
> 
> Items: SetOf(TClass);
> 
> which could implement
> 
> Items.SortBy := TClass.Property;
> 
[...]
> with body of "unsubscribe delphi"
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to