[fpc-pascal] Selecting Records with a variable

Sven Barth pascaldragon at googlemail.com
Sun Dec 20 15:44:44 CET 2020


Am 20.12.2020 um 14:47 schrieb Tomas Hajny via fpc-pascal:
> On 2020-12-20 11:56, Sven Barth via fpc-pascal wrote:
>> Am 20.12.2020 um 05:26 schrieb Jean SUZINEAU via fpc-pascal:
>>>
>>> I know you don't like objects, but maybe something like :
>>>
>>
>> Using modeswitch AdvancedRecords that also works with record types.
>>
>> And I'd suggest a case-statement as well. Anything else will only be
>> slower or just as fragile.
>
> If I understand the original case correctly, the wanted behaviour 
> should be doable using (extended) RTTI, shouldn't it? Not that I'd 
> know how to do that myself, but my (admittedly limited) understanding 
> of RTTI suggests this as a possible solution, am I wrong?

That's why I said "slower or just as fragile". The solution with the 
(not yet existing) extended RTTI would work, but it would be slower than 
the hardcoded case statement.

Regards,
Sven


More information about the fpc-pascal mailing list