[fpc-devel] Generic Programming Units
kuifwaremailinglists at xs4all.nl
Thu Jun 23 12:31:25 CEST 2005
Marco van de Voort wrote:
> I found a png, but can't seem to find the original file (it is in .dia
> format), will have to search for it.
If you can't find the eps - or never had any - I can create one on my own (using xfig).
Anyway, here is a patch for the tex file which fixes
- unwanted extra } at the end of code line
- some small errors in the text
- unwanted spaces in \emph and \textbf
- removed tabs in code
- fixed new paragraphs starting in the middle of a sentence
Still remaining problems are:
- the lstlisting environment doesn't highlight Pascal properly
- some lines of code are too long
and I probably have overlooked some remaning errors of course.
Perhaps the lstlisting should be replaced by some command from fpc.sty?
The use of TVarRec has it's disadvantages when it comes to speed and memory usage, but definitely makes things easier for the programmer. I think only Generics can beat that! I don't know whether the internals of Decal are bulky, but that doesn't result simply from using TVarRec.
Btw TVarRec is only 8 bytes in size, where variants require 16, so it isn't /that/ bad :)
Anyway, for high perfomance it is better to store only a pointer. In that case the programmer has to inform the container about the type it actually stores (or pass a custom comparator) so the container knows how to compare items.
Besides containers, there is also the SuperStream library, which seems to be very nice too. For this library, the use of TVarRec makes life easier too. Though maybe using RTTI and published properties can be easier, the scheme of SuperStream is very powerful.
Note for people searching for .pas sources: the original sources from Soletta are on http://cvs.sourceforge.net/viewcvs.py/decal/ and are also (modified) on fpc cvs/contrib (http://www.freepascal.org/cgi-bin/viewcvs.cgi/contrib/decal/?root=projects).
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the fpc-devel