wrong again. It is actually a singleton after assignment. The same happens with e.g. the memorymanager entrypoints in system.pas.
When I said writable constant doesn’t make senses, I was talking about the semantic. A constant shouldn’t be allowed to be changed once it contains a value. If you need to change the value later then it should be a variable, not a constant. Hence, writeable const in Pascal is semantically wrong.
But since it’s there since the Turbo Pascal era as the legacy from Borland and too much codes depend on it, we can do nothing but maintain that semantic. However, as we have the option to disable it (using $J- compiler switch), we have a choice to disable it on new codes and using initialized variable instead. Even Delphi have had disable it by default. Why didn’t FPC too?
A var would be way to much scope (although it is a great deal a notational issue, const is more correct here.)
Why
var and
const have different scope?