Hi devs,
I'm trying to move a 285.000 line old Borland Pascal protected mode program to a more modern platform. So a Client-terminal, and a server. Converting the old Btrieve databases to SQL. All that is done in FPC and Lazarus. Very good experience!
But turning a single user program into a multi-user Session is not a small task in a program of that size, and obviously the dseg-vars and consts are something that has to be dealt with. The vars are pretty much a piece of cake, thanks to Threadvar (a genius solution). It couldn't be easier. 11/10.
Now the Consts are a different story. The mutable ones (Name : LongInt = 100;) needs to be converted to Threadvars and manually initialized, unless the initial value is 0. So I now have 70 files with a [UnitName]_InitConsts procedure, and a Consts unit with a InitAllConsts, that's called at the very start of the Session code. Now that works, but it's pretty bad:
1) Find the Mutable Consts, go through all the files and do the work to change Const to Threadvars and make the _Init procedure, and document it. Not a small task.
2) You can't use Const anymore for mutable consts. The nice functionality that Consts give you now belongs to the good old days

3) Your Vars and your Consts are now mixed together as Threadvars and only the Consts are initialized in the Init procedure, as the real Vars are initialized in the code. You have to keep track of that with comments, so you can remember which vars are initialized in the code, and which are "old" Consts converted to Threadvars. It's messy, and harder to use and maintain.
A Threadconst would make all that as simple as using Threadvar. I'm sure most people who benefit from Threadvar, in any project, could benefit from Threadconst too.
I hope you will take it into consideration. Thank you.