[fpc-devel] OO rewrite - technical questions

Hans-Peter Diettrich DrDiettrich1 at aol.com
Mon Jul 19 11:40:20 CEST 2010

One requirement in a transformation into OOP is the replacement of all 
affected procedures by methods, and of many (currently global) reference 
variables by class members. When e.g. later multiple parser instances 
are created, one for every unit to compile, the current compiler 
directive handling should be redesigned.

Does somebody have experience with (lists of) procedural variables?

I can see these possible solutions for the replacement of procedure 
references, in e.g. the list of compiler directives:

1) The currently global list is duplicated for every scanner/parser 
instance, so that it can contain references to the concrete method 
instances. Fast execution, but more data and setup.

2) The procedure references are modified when actually used, i.e. the 
instance reference of the method pointer is replaced by the current 
instance, before the method is called.

3) The procedure references are replaced by directive IDs (enum), with 
an according case selection in the parser instance.

4) The procedures will not become methods, but will receive an 
additional instance reference as a parameter. This approach may result 
in the best SVN history, but may not be usable with threads, later.

Any ideas?


More information about the fpc-devel mailing list