[Pas2js] pas2js doesn’t support -Sj
Mr Bee
pak.lebah at yahoo.com
Sat Feb 1 15:21:21 CET 2020
Writable constant indeed doesn’t make any sense, either in semantic or scoped variable. That’s why I prefer to disable it by default. Even Delphi had it disabled since Delphi 3, if my memory serves me right. However, this topic had been discussed over and over since a decade ago in FPC list but nothing changes. FPC still enables it by default both in Delphi and FPC mode.
–Mr Bee
Pada Sabtu, 1 Februari 2020 19.30.38 WIB, Michael Van Canneyt <michael at freepascal.org> menulis:
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.
_______________________________________________
Pas2js maillist - Pas2js at lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20200201/e9f4d624/attachment-0001.html>
More information about the Pas2js
mailing list