Hello, I want to write code as follows and I will simplify it here to illustrate the problem.
Let's say I want to kinds of records: TrecordA and TrecordB. I want to be able to convert types of TrecordA to TrecordB but I also want to be able to convert types of TrecordB to TrecordA. So I was thinking of writing code as follows: type TrecordA = record function ToRecordB : TrecordB; end; TrecordB = record function ToRecordA : TrecordA; end; These two functions would return a value type/a copy of itself but converted. However there is ofcourse a problem, there is a circular reference, and as far as I know delphi or free pascal cannot forward declare records ? I could use forward pointers perhaps, but that would be a bit weird and might lead to bugs because of automatic stack variables/value types being automatically cleaned up, using pointers would pretty much dismiss the value types, I could also use dynamic memory but this would create further problems, since records do no have destructors, the last possible option is using classes instead of records, so then class forward declarations could be used, but the records are kinda simply and classes is probably a bit overkill. So to me it seems this basic functionality that I seek seems to be missing from the object pascal/delphi language, so perhaps it can be added to a future version ? Bye, Skybuck. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel