[fpc-pascal] class constants

Peter Vreman peter at freepascal.org
Thu Jan 24 23:36:35 CET 2008


> Marco van de Voort wrote:
>>> Marco van de Voort wrote:
>>>>> Does FPC support class constants, and if it doesn't, are there any plans
>>>>> to add this support?
>>>> Have a look at
>>>> http://www.freepascal.org/faq.var#extensionselect
>>>>
>>>> The question would be "what would make this possible?"
>>> What about class vars?
>>
>> Same answer.
>
> Some form of classvars would make it possible to do something I do in
> 1) the Lazarus LCLComponent to set a class variable. (now I'm forced to
> do that on every instance of that class or a derived class).
> 2) Store debugger configuration like is done for lazarus debuggers.
> (now I store a seprate config instance in a stringlist based on the
> debuggerclassname)
> 3) there was another case, but I don't recall it atm.
>
> Anyway I worked my way around it, but classvars would have made this
> easier. I do realize that providing patches is the best way to get
> something implemented, but since my workarounds, there is no big need
> anymore.

There is already support for static field in objects and classes. These act like globals, but
scope is limited to the object/class.






More information about the fpc-pascal mailing list