On 01.07.2019 21:04, Michael Van Canneyt wrote:
On Mon, 1 Jul 2019, Ondrej Pokorny wrote:
On 01.07.2019 19:38, Michael Van Canneyt wrote:
On Mon, 1 Jul 2019, Ondrej Pokorny wrote:
On 01.07.2019 18:21, Michael Van Canneyt wrote:
On Mon, 1 Jul 2019, Ondrej Pokorny wrote:
From the above example "Mytest.StringArray" can only evaluate to TTestObjectEnumerator. Nothing else.

Well, this is IMHO not correct. The array is also a possibility.

The compiler encounters Mytest.StringArray - at that point he has 2
possibilities. It's an array (and an index must expected) or it is an
enumerator (and nothing must be expected), but at this point the compiler
cannot decide without looking at the context.

There is no array. "property StringArray[Index: Integer]" is not an array and cannot be evaluated as an array.

Please, you know what I mean... It is an "array property".

Sorry - I didn't mean it bad/ironic/whatsoever. I just thought you meant that:

MyArray := Mytest.StringArray;

might be a valid assignment for

  TTest = class
  public
    property StringArray[Index: Integer]: string read GetString;
  end;
  TMyArray = array of string;

If it was a valid assignment, there would be 2 possibilities indeed and the compiler would need to check the left side to resolve the overload:

MyArray := Mytest.StringArray;
MyEnumerator := Mytest.StringArray;

But such syntax is invalid for indexed (array) properties.

Ondrej

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to