[fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

Ryan Joseph genericptr at gmail.com
Fri Jun 28 00:00:56 CEST 2019



> On Jun 27, 2019, at 5:57 PM, Sven Barth via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
> 
> If it's a bug (what I do indeed think of this and the other bug you mentioned) it's considered acceptable to break backwards compatibility. After all we wouldn't be able to fix essentially anything as some code out there might rely on the behavior. 
> 

Did you see the other users note in my bug report? Looks like this:

 tINIFile = object
  private
    procedure SetAsText( akey:PAnsiChar;val:PAnsiChar); overload;
    procedure SetAsText( asection,akey:PAnsiChar;val:PAnsiChar); overload;
    procedure SetAsText(ans,asection,akey:PAnsiChar;val:PAnsiChar); overload;

    function GetAsText( akey:PAnsiChar):PAnsiChar; overload;
    function GetAsText( asection,akey:PAnsiChar):PAnsiChar; overload;
    function GetAsText(ans,asection,akey:PAnsiChar):PAnsiChar; overload;
  public
    property Value [ans:PAnsiChar; asection:PAnsiChar; akey:PAnsiChar]:PAnsiChar
             read GetAsText write SetAsText; default;
  end;

====================

Try it and play around but it works to call value with variable number of parameters. 

Does that mean 2 bugs with properties then? allowing var and out in properties seems wrong also.


Regards,
	Ryan Joseph



More information about the fpc-devel mailing list