[Pas2js] pas2js doesn’t support -Sj

Michael Van Canneyt michael at freepascal.org
Sat Feb 1 13:30:34 CET 2020



On Sat, 1 Feb 2020, Sven Barth via Pas2js wrote:

> Am 01.02.2020 um 09:33 schrieb Michael Van Canneyt:
>> If 20 years after the demise of Turbo Pascal we cannot expect people 
>> to change a couple of consts into a var, then all hope for humanity 
>> (well, at least the pascal programming community) is simply lost.
>>
>> FPC was created when TP still existed. It made sense to allow writable
>> const for easy porting. Same for Delphi. But IMHO not in a new tool 25 
>> years after the facts.
>
> The main use of writable consts that you can only cover with OOP 
> otherwise is static, scoped variables. I personally agree that global 
> constants should be declared as readonly, but for local ones there might 
> be a use for it even if you or I don't necessarily consider it a good one.

Indeed, I don't see the point of static scoped variables. 
But if you need those, then I'd rather see

var a : integer; static;

or something similar, than

const
   a : Integer= 0;

Const should be exactly that, a const. My guess is that the original
"writable const" was simply a bug declared a feature.

Michael.


More information about the Pas2js mailing list