[fpc-devel]Some property-wise inconvenience

Michael Van Canneyt michael.vancanneyt at wisa.be
Wed Jan 23 15:06:45 CET 2002


On Wed, 23 Jan 2002, Aleksey V. Vaneev wrote:

> Hello,
>
>   Just noticed some difficulty in property's "array of something"
>   support.
>
>   For example, if I've declared something like:
>
> type
>    T = class
>    protected
>      arr1: array of Double; (or ^Double);
>    ...
>
> I cannot use something like this:
>
>    public
>      property arr [i: LongInt]: Double read arr1;
>
> Of course, I can use function instead, but that is not what I'm for.
> Firstly, accessing array this way will be much slower, and
> secondly, by declaring property in such a way I just wanted to warn
> user that this array is read-only (BTW, with single variables this
> works really nice).

1. As far as I know, Delphi also doesn't support this.
2. As declared above, there is no possibility of range checking. So this
   is dangerous.
3. AFAIK The function approach will not be much slower on new processors.

Michael.





More information about the fpc-devel mailing list