[fpc-devel] Feature request/discussion - SetLengthNoInit
Ryan Joseph
genericptr at gmail.com
Fri Sep 18 17:11:58 CEST 2020
> On Sep 17, 2020, at 7:23 PM, Ryan Joseph <genericptr at gmail.com> wrote:
>
> Certainly. I think it depends on what the solution is. It's a known short coming of the [] property and if the solution is as easy as allowing a var param variant then maybe it's feasible.
I'm remembering now I believe we did discuss this and it falls into the category of "not as expected" behavior because it appears like the [] property to write to record fields should work, because the language already gave you that idea from normal static/dynamic arrays. I may have even asked why it didn't work on the mail list and was reminded that it's a feature of the getter method which copies the record as it passes it back. That's not obvious to the programmer unless you really think about how the property is implemented under the hood by the compile.
It would be more intuitive is the record was passed by reference, just like it is using normal [] operators on arrays.
Regards,
Ryan Joseph
More information about the fpc-devel
mailing list