[fpc-pascal] Const attributes
Marcos Douglas B. Santos
md at delfire.net
Sun Jul 30 23:05:28 CEST 2017
On Sun, Jul 30, 2017 at 5:47 PM, Sven Barth via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:
> On 30.07.2017 20:55, Marcos Douglas B. Santos wrote:
>> I would like to instantiate my attribute only once inside constructor
>> and then it will be "const" or "final", I mean, immutable.
>> Today it is not possible, right? Any thoughts to the future?
> With the JVM platform support for final fields was added (modeswitch
> finalfields), but that is currently only available for external classes
> (which only exist for the JVM target) as the DFA can't handle that
> correctly currently.
> (though if one would restrict the assignments to the constructors itself
> without any methods called by the constructor then we might be able to
> implement that nevertheless, don't know what Java or other languages
> with final fields allow here)
It would be great to use "modeswitch finalfields" in all possible modes.
More information about the fpc-pascal