[fpc-pascal] GetEnumerator on Generics

Neil Graham Lerc at screamingduck.com
Mon Mar 1 09:17:24 CET 2010

So some things, 

I'm working on a browser plugin

And I've made a Thefbi Target for Freepascal,  The example
page shown in the screenshot

Is actally written in Freepascal, So if people are interested in having
a hack around at something that does Flash Like things only using
FreePascal as a language then by all means, dive in.

Now, because of the nature of the plugin, Development is more akin to
embedded development, The Thefbi target was brutally hacked together
from bits of the Embedded/GBA/NDS etc. targets.

It has given me the opportunity to Experiment with Stripping Down the
RTL, since compatibility going all the way back to Turbo Pascal isn't

Which, somewhat laboriously, brings me to my query.  
I'm shunting all of the containers from fgl into the standard Thefbi
unit and removing the 'fpg' from the class prefixes. So on my system
tList is the tFPGList fro fgl.
I'd like to add a GetEnumerator to those classes, but I'm unsure as to
how to define the enumerator type. which needs to be a class that can
hold a reference to the specialised generic container. 

I attempted with a couple of notations that I figured might work, but no
luck,  The problem is the same as for making a linked list,  How to
define a field within a generic to be the type of the generic itself.  

http://wiki.freepascal.org/Generics provides many hints as ways it
_might_ be done, but I think the page needs someone who knows what made
it into the compiler to go through and mark them. 

More information about the fpc-pascal mailing list