[fpc-devel] Generic Programming Units

Bram Kuijvenhoven kuifwaremailinglists at xs4all.nl
Tue Jun 21 23:33:12 CEST 2005


Dean Zobec wrote:
> I can immagine,  the DObject is a TVarRec.  The problem with speed and
> memory usage are the things that I don't like in Decal and it still
> makes me wonder if it would be better to reimplement a containers
> library from scratch, if we had generics to add type checking at compile
> time... I'm looking at all the options (time is a limited resource :).

Generics are indeed very nice to have. But if we want a nice data structures and algorithms package before generics are implemented, we will have to do without for now.

When Generics are supported by the compiler, the unit(s) could be adapted to use Generics. By that time, there would be quite some feedback and experience from the first implementation. This can help creating a package using Generics that is also well designed. (i.e. we can learn from 'mistakes' in the first implementation)

On the other hand, there is already a lot of experience from other similar libraries, such as Decal, STL, java.util, etc. But that might not be part of the experience of the programmer implenting such a package for FPC.


Besides using TVarRecs, we could also use pointers (as in classes.TList) or objects. This would perhaps be a bit like it is in java.util. Then we would also need container classes for basic types such as boolean, integer, string and float. I'm not sure whether this is indeed a good plan, but I'm just mentioning it because you said you want to look at 'all the options' :)


Anyway, I'm very interested in a library with commonly used generic data structures and algorithms, and I think there are many more such developers. So I'd say: keep up the goods plans & work!


Regards,

Bram




More information about the fpc-devel mailing list