[fpc-devel] [] property overloads
Michael Van Canneyt
michael at freepascal.org
Mon Jul 1 21:04:19 CEST 2019
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:
>>>>> On 01.07.2019 15:57, Ryan Joseph wrote:
>>>>> TTest = class
>>>>> public
>>>>> // ...
>>>>> property StringArray[Index: Integer]: string read GetString;
>>>>> property StringArray: TTestObjectEnumerator read GetString;
>>>>> end;
>>> 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".
>
> If the compiler encounters "Mytest.StringArray" it can be evaluated only
> as the non-indexed overload.
Well... We can of course discuss forever, and still not agree.
I suggest we let the compiler people have the last word on this.
They know best. And if you turn out to be right: so much the better.
Michael.
More information about the fpc-devel
mailing list