[fpc-pascal] Const attributes

Marcos Douglas B. Santos md at delfire.net
Sun Jul 30 20:55:34 CEST 2017


On Sun, Jul 30, 2017 at 1:46 PM, Maciej Izak <hnb.code at gmail.com> wrote:
> 2017-07-30 18:37 GMT+02:00 Marcos Douglas B. Santos <md at delfire.net>:
>>
>> 1. Is this by design?
>
>
> Yes. To disallow this you need to use {$J-} directive.

I know that we can use this "hack" in local functions/methods, but in
an attribute... What is the goal to use it?

>>
>> 2. Is there a way to declare attributes "final" like Java does?
>
>
> No for constants.

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?

Regards,
Marcos Douglas



More information about the fpc-pascal mailing list