I hope they do allow you to fix it, because those features look useful,
especially with custom-made dynamic arrays (through a generic record).
I've got to try playing with them now to see if I can make something
that Chris Rorden would use!
Though not really related, it's not easy to specify a pointer to a type
parameter in a generic type. For example, if I try to declare:
type generic TMyArray<T> = record
Data: ^T;
Length: PtrUInt;
end;
The compiler will complain about T being an unresolved forward
declaration. Outside of specifying a second parameter for the pointer
type (which would be a little unfriendly for third-party users), there
isn't really a way around this.
Gareth aka. Kit
On 17/09/2020 03:08, Ryan Joseph via fpc-devel wrote:
On Sep 16, 2020, at 9:10 PM, J. Gareth Moreton via fpc-devel
<fpc-devel@lists.freepascal.org> wrote:
I figure I could design a dynamic array class, but it will very likely be
incompatible with SetLength no matter what I try to do, and unless I'm
mistaken, it won't have the benefit of automatically gaining an implicit
clean-up blocl if used as a local variable unless there's an automatic
reference counting feature that I'm not aware of.
There are operators to do this now but they're only for records
(https://wiki.freepascal.org/management_operators). You can easily make a
reference counted type now but as I mentioned that are some drawbacks, some of
which I'd like to correct if the compiler team allowed it.
Regards,
Ryan Joseph
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel