[fpc-devel] Variant Records and Duplicate Identifiers

Sven Barth pascaldragon at googlemail.com
Fri Apr 22 10:50:28 CEST 2016


Am 22.04.2016 10:05 schrieb "Maciej Izak" <hnb.code at gmail.com>:
>
> 2016-04-21 8:00 GMT+02:00 <kevin at kdx.me>:
>>
>> type
>>   maritalStates = (single, married, widowed, divorced);
>>
>>   TPerson = record
>>     name: record
>>       first, middle, last: string;
>>     end;
>>     sex: (male, female);
>>     dob: TDateTime;
>>     case maritalStatus: maritalStates of
>>       single: ( );
>>       married, widowed: (marriageDate: TDateTime);
>>       divorced: (marriageDate, divorceDate: TDateTime;
>>         isFirstDivorce: boolean)
>>   end;
>>
>> So the question then becomes: is the wiki in error, or is there
something I'm missing? Furthermore, if the wiki is in fact wrong, and this
is a limitation, is there any inherent reason why? It seems to me like this
should be possible, it's certainly a very useful thing to have.
>
>
> That is 100% bad example. You can't have two fields with the same name
even for that kind of record with "case" part. Correct example:

You know that this was the point of the example? Cause the documentation
seems to be a bit misleading there as Kevin wrote in his original mail.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20160422/55ea6953/attachment.html>


More information about the fpc-devel mailing list