[fpc-devel] [] property overloads

Ondrej Pokorny lazarus at kluug.net
Mon Jul 1 18:08:55 CEST 2019


On 01.07.2019 15:57, Ryan Joseph wrote:
> Yes, I’ve made a patch to allow overriding the actual property (https://bugs.freepascal.org/view.php?id=35772).

Very good! Just a short question: does your solution allow one overload 
without array indexes? It is very useful as a for-in enumerator of the 
array property:

   TTest = class
   public
     // ...
     property StringArray[Index: Integer]: string read GetString;
     property StringArray: TTestObjectEnumerator read GetString;
   end;

procedure DoTest(a: TTest);
var
   s: string;
begin
   for s in a.StringArray do
     Writeln(s);
end;

See full code: 
https://bugs.freepascal.org/file_download.php?file_id=23296&type=bug
(File arraypropenum.lpr in https://bugs.freepascal.org/view.php?id=28820

Ondrej



More information about the fpc-devel mailing list