[fpc-devel] OO rewrite - technical questions
DrDiettrich1 at aol.com
Mon Jul 19 12:29:44 CEST 2010
Michael Schnell schrieb:
> On 07/19/2010 11:40 AM, Hans-Peter Diettrich wrote:
>> 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?
>> Any ideas?
> While I in fact don't understand the meaning of your post:
> Regarding OOP, would it not be better to do lists of objects with class
> procedures instead of lists of procedural variables. So these classes
> would be children of a parent class and you can do a clean list (TList
> derivate, array or whatever) of same.
I also have problems to understand your answer :-(
The directive list contains records with the name and other attributes
of every directive, and with a reference to the directive handler procedure.
These handler procedures need further information, that currently
resides in global variables. In an OO approach these variables become
class members, so that an additional reference to a concrete object is
required in the directive handlers.
In so far "class procedure" doesn't help, if you meant that, because
Self in a class procedure is the class type, not a class instance.
It's also useless to create new classes, because the handlers need
access to the elements in a concrete parser/scanner class (instance).
More information about the fpc-devel