[fpc-pascal] Writeable typed constants - what's the point?

Graeme Geldenhuys graemeg at opensoft.homeip.net
Fri Jun 19 12:00:30 CEST 2009

Martin Friebe wrote:
> The const version act like a global variable. It is set to 1 once at
> some time before the 1st call to Foo. It will not be initialized again.
> If Foo chages it, it will keep the changed value, even between calls to

Then this is a language issue. 'const' is clearly not the correct type
declaration for that variable. As suggested suggested earlier, it would
make more sense to maybe implement something like shown below - or
whatever language construct the developers can come up with.

  a: word = 1; static;

'const' or constant is simply not a very accurate description of the
usage of that "writeable" variable/constant. It goes against the "easy
readability design" of the Object Pascal language, and is very unclear
as to the meaning of that typed constant.

  - Graeme -

fpGUI - a cross-platform GUI toolkit using Free Pascal

More information about the fpc-pascal mailing list