You can use read function:

var
  DirectAccessToValue: T;

function Value: T; inline;
begin
  Result := DirectAccessToValue;
end;

begin
  ...
  DirectAccessToValue := ...;
  ...
  DoSomething(Value);
end.


On Sat, Nov 28, 2009 at 13:55, Markus Glugla <f...@xgelb.de> wrote:
> Hello,
>
> is it possible to set a variable in a programm as a readonly variable?
>
> I would set a variable at a position in the runing programm. Since this
> time the variable should be readonly. The next set of the variable
> should produce an error.
>
> In bash programming you found a command "readonly" making this effect.
> Is there a command for FreePascal?
>
> Thanks,
> Markus
>
> program readonly;
> ...
> v:=1; // At this position it should be readonly.
> ...
> end.
>
>
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



-- 
Aleksa Todorovic - Lead Programmer
Eipix Entertainment
http://www.eipix.com/
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to