[Lazarus] Forward declare (modern) records [was: Re: "global" operator overloading]

Sven Barth pascaldragon at googlemail.com
Tue Feb 26 16:18:33 CET 2013


On 26.02.2013 16:15, ListMember wrote:
>
>> All three types, records, objects and classes have their purposes and
>> uses and one can select the one that is most fitting in a given
>> situation.
>
> Is it possible to forward declare records the way we can with classes?
>
> I mean, with classes, I can do this:
>
> TSecondClass = class;
>
> TFirstClass = Class(TObject)
> private
>    FSecondClass: TSecondClass;
> public
> end;
>
> TSecondClass =  Class(TObject)
> private
>    FFirstClass: TFirstClass;
> public
> end;
>
> but, I don't seem to be able to do the same with records --I am
> referring to the new/modern records.
>
> I can see why it isn't immediately available, but it would be so much
> nicer if fpc handled the pointer stuff in the background.

It would be no use anyway. You CAN NOT have the record used as a field 
inside itself, so you'd need to define a pointer type anyway. And this 
is something where we won't do things behind the programmers back. If 
you need a pointer then you declare one.

Regards,
Sven





More information about the Lazarus mailing list