[fpc-devel] RIP NoGlobals

Hans-Peter Diettrich DrDiettrich1 at aol.com
Wed Sep 29 22:05:27 CEST 2010

Florian Klämpfl schrieb:

>> too much supported platforms and
>> features and too few developers working on bug fixing.
> Just as a side node, development of open bugs during the last years:
> summary_graph_cumulative_bydate.php.png

This situation could be improved by an OO rewrite - better 
modularization, separation and encapsulation of the entire compiler parts.

In the past months I've been working on several aspects of such refactoring:
- moving global variables into objects (mainly current_module)
- turning back-ends into classes
- separation of parser (front-end) from AST processing (building AST, 
optimization, code generation)

When we agree to turn the current codebase into such an OO approach, 
eventually adding documentation, the maintenance could be simplified a 
lot. During my experiments I've learned how fragile the current state of 
the compiler codebase is - even a minor change can have inpredictable 
consequences in other parts of the code. Chasing and fixing an bug would 
be much easier, when it can be isolated in a specific compiler module, 
and then can be fixed with only local impact. Visual debug features (AST 
treeview, ASM preview...) can be added without affecting the release 
versions - such features already turned out to be very useful, in all my 
decompiler development.

Since such refactoring affects really *all* existing units, it could be 
done in a very new repository, resulting in an FPC 3.0 version. Then we 
can agree which road to follow - the old spaghetti code or the new OO 
approach - or whether we fork and follow both branches independently.


More information about the fpc-devel mailing list