On 30/07/17 19: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?
It is not what you are asking for, but you can do this:
===code begin===
{$J-}
const
INT: Integer = 9;
type
TFoo = class
strict private
function GetINT: Integer;
public
property INT: Integer read GetINT;
end;
function TFoo.GetINT: Integer;
begin
Exit(INT);
end;
===code end===
The INT property is 'immutable' because it is read-only, and you cannot
assign to its typed integer referent because of the {$J-}.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal