On Mon, 23 Sep 2013, Frederic Da Vitoria wrote:
Yes. But that works only for 'simple' types and still requires you to write
code.
For the more general case where you can have arrays, classes, interfaces and
whatnot as fields of your object, there is simply no correct way.
Isn't there? Maybe it wouldn't be easy, but IIRC Delphi offers something
related to this with TComponents and Streams. This Delphi mechanism I knew
worked only for properties,
but I found references that there existed a wider mechanism in D2010.
There is no GENERAL way.
The RTTI based mechanisms make special assumptions about how to reference
components, tpersistents and whatnot.
If I have a field that is a stream. How are you going to correctly copy this ?
Just the stream instance pointer ? The stream+Contents ?
The answer depends on how the classes are supposed to behave. The language
itself cannot give you this mechanism.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal