[fpc-devel] TList or TFPList - a Linked list ?

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Dec 14 22:15:56 CET 2005


On Wed, 14 Dec 2005 21:56:19 +0100
Micha Nelissen <micha at neli.hopto.org> wrote:

> On Wed, 14 Dec 2005 21:44:50 +0100 (CET)
> Daniƫl Mantione <daniel.mantione at freepascal.org> wrote:
> 
> > Op Wed, 14 Dec 2005, schreef Micha Nelissen:
> > 
> > Sorry to disappoint, but this doesn't look a very good idea to me; it 
> > would kill code that for example tries to sort a list. There will be
> > also  a lot of code that iterates using index[].
> 
> Did you read the paragraph, "to solve (2) ..." ? Sorting is also quite a
> "local" operation, no ? No truly random-access is needed.

Examples:
- Binary search
- Quicksort in TList.Sort

  
> > Programmers need both list like datastructures and array like data 
> > structures. It is part of converting mathematical abstraction principles
> > 
> 
> Array like datastructures are provided by dynamic arrays, I'd say ?

Yes

 
> > like a sequence where every operation is O(1), to actual datastructures 
> > that are to be used inside a compiler. Programmers need both of them,
> > not  one or the other.
> 
> Yes, currently there is no linked list at all, is there ?
> 
> These issues are precisely the reason I'm writing to the list and
> gathering ideas first.

It was one of Borland best ideas to name a dynamic array a 'TList'.
You can implement a TLinkedList and TDoubelLinkedList like the glib's glist.

Mattias



More information about the fpc-devel mailing list