[fpc-pascal] Constants in generics

Sven Barth pascaldragon at googlemail.com
Wed Apr 12 17:28:49 CEST 2017


Am 12.04.2017 17:06 schrieb <noreply at z505.com>:
>
> On 2017-04-09 06:32, Ryan Joseph wrote:
>>>
>>> On Apr 9, 2017, at 6:13 PM, Maciej Izak <hnb.code at gmail.com> wrote:
>>>
>>> sure, but not directly. Try this:
>>
>>
>> Thanks, that’s a seriously funky hack but it works. :) The only
>> downside is you need to define types every time you need a different
>> size.
>>
>> Is this a known feature request or anything on the to-do list for the
>> compiler team? There’s no way to extend the functionality of static
>> arrays in Pascal and this would accomplish that well.
>>
>
> The only way I can think of extending the functionality of a array is to
put it into an old borland object (on the stack) but that may not be what
you are looking for. Then you can give the array methods, effectively,
possibly reinventing TStringList ;-) and that array can be fixed, dynamic,
whatever. But as for generics, no, old borland style objects are not going
to be generic - so this email of mine is likely completely and utterly
irrelavent to your problem  domain :-)
>

Generic TP-style objects are supported in FPC, but you can use advanced
records (which allow methods as well as management operators) as well.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170412/9be658dc/attachment.html>


More information about the fpc-pascal mailing list