Am 01.01.2024 um 16:51 schrieb Wayne Sherman via fpc-pascal:
On Mon, Jan 1, 2024 at 6:14 AM Hairy Pixels wrote:
On Jan 1, 2024, at 3:50 PM, Michael Van Canneyt wrote:
You can't optimize that. As said, a generic is convenient but slow.
I don't know about that. Like was mentioned the enumerator needs to return a
pointer, preferable without ^ so it feels like a record and only use that in 
the for-in
scope. You can kind of do that yourself but it's cumbersome to maintain and
missing from the RTL (maybe for this reason).
Modern Pascal compilers already do this for certain types and pass by
reference parameters.  For example, AnsiString variables and variables
of type class are handled internally as pointers, but manipulated
opaquely without explicit pointer notation.  A record passed as a var
or constref parameter is internally a pointer, but does not require
the code writer to handle it explicitly as such.
That kind of concept only exists in Pascal for parameters, but not for variables or result values as would be needed for this.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to