[fpc-pascal] Generic routines for both dynamic array and other collections

Виктор Матузенко vitek03 at gmail.com
Tue Feb 23 00:21:06 CET 2021


пн, 22 февр. 2021 г. в 16:11, Sven Barth via fpc-pascal <
fpc-pascal at lists.freepascal.org>:

>
> Arrays are simply no structured types,
>

Actually they are...


> thus them having "properties" is wrong as well. If users want expect
> arrays to be object oriented they should use corresponding languages like
> Java or C#.
>

I don't want them to be objects, I want to write some functions once and be
able to specialize them
for many different types. I thought this is exactly the purpose of the
generic routines feature.

Example of such an algorithm is binary search. I am able to access elements
with [] operator of both
arrays and objects, but I cannot get length in a generic way.

-- 
Victor Matuzenko (Виктор Матузенко)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210223/22c05480/attachment.htm>


More information about the fpc-pascal mailing list