[fpc-pascal] array & record output/input
José Mejuto
joshyfun at gmail.com
Wed Jun 2 19:56:57 CEST 2010
Hello FPC-Pascal,
Wednesday, June 2, 2010, 2:56:29 PM, you wrote:
V> ooh. php has 'print_r' for printing arrays/objects - an equivalent
V> ArrayToStr would be handy to have in Pascal. while pascal is my favourite
V> language, I'm finding it poorly supported compared with php :(
That's not a matter of support, to writeln a record you must keep the
structure information at runtime which is a must for scripted
languages but it is not needed at all for a compiled one (native
code). So if you keep that information people will complaint about
memory footprint and compiler not hidding internal program structures
and other now complaint about it can not writeln a record :-?
If you want to do something like that replace yout records with
classes and put the fileds in the published section so you will have
RTTI information about the class and you can write a generic writeln
function for classes writting the published fields.
--
Best regards,
José
More information about the fpc-pascal
mailing list