You want the type of the object to be included in the type of the 
collection?

am I right to think you want this: 
TMySet = set of (TMyClass);

MySet : TMySet;
MyOtherClass : TMyOtherClass;

...

  MySet.Add( MyOtherClass); // Error Here!!

But it is possible to implement this - verbose, and a 
lot of effort for something simple, and mostly 
at runtime (a smalltalker shouldn't be afraid of that ;) but possible. 

Neven MacEwan wrote:
> 
> Kurt
> 
> The problem is not so much TList and TCollection (or TObjectList or
> TOwnedCollection) but a limitation
> in object pascal itself - Without it being included as base type it can't be
> type safe.
> 
> Someone will correct me if I'm wrong but the only OO thing about object
> pascal  is the keyword 'class',
> but none of the base types are OO
> 
> They almost did it in D5 with dynamic arrays it would seem to be so simple
> to extend it to..
> 
> AClass = class
> end;
> 
> Var
>   anArray: array of AClass
> 
> TTFN
> Neven
> 
> > 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.
> 
> ---------------------------------------------------------------------------
>     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"
---------------------------------------------------------------------------
    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