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

Graeme Geldenhuys graemeg at opensoft.homeip.net
Thu Jun 18 11:45:15 CEST 2009

Florian Klaempfl wrote:
> Nevertheless, writable typed constants are simply an important part of
> Borland style Object Pascal.

I'm not arguing that. Then maybe writeable typed constants should be
disabled for compiler mode delphi at least. It's a Delphi compatibility
issue after all.

Just this morning I got confirmation that code I wanted to implement in
tiOPF did not compile under D7 and D2009. I had to introduce IFDEF
Delphi and $J+ around the writeable constant. tiOPF and FPC used mode
delphi throughout the framework.

>> FPC often implements something that breaks existing code. 
> Examples :)?

Please note that I am not saying I disagree with the changes. I know
they were introduced for the better. What I am saying, is that changes
do get introduced into FPC (for whatever reason) and does sometimes
break existing code.

Example #1:
  You cannot pass a property as var parameter anymore. Introduced in

Example #2:
  Boolean type change in Xlib units. TBool(false) or TBool(true) type

Example #3:
  ComponentState change. I wasn't allowed to use the following code
  anymore:  Include(ComponentState, csDesigning);

I think there was a few more that affected fpGUI Toolkit project, but I
think you get the idea. As long as code is being maintained, such
changes are not the end of the world. :-)  But my point is, they do happen!

> Then I'll tell you what's the difference to writable typed
> constants.

OK, now tell me... :-)

  - Graeme -

fpGUI - a cross-platform GUI toolkit using Free Pascal

More information about the fpc-pascal mailing list