Hello,

Is there a (builtin, simple) way to output the content of an array or of a 
record. Something like arrayToStr / recordToStr, that would return a normal 
form similar to the literal notation used for intialisation? If no, is there a 
way to write custom funcs for this purpose (meaning access at runtime to types 
of items/fields). I constantly need such a feature.
    writeln(recordTostr(aPosition)) // --> (x:1 ; y:2 ; z:3)
    writeln(arrayTostr(someInts))   // --> (9, 8, 7)
(Additionally, once we have this, a "view" func could call the appropriate 
*ToStr according to actual type, and a "show" procedure could use writeln on 
the result of view... then I'm happy :-)

Side-question, upon the opposite point, just to be really sure: array & record 
literal notations can only be used in declaration (var/const), meaning for 
initialisation. But cannot be used to assign a var in a statement block. 
Correct? If yes, what is the issue (for the parser/compiler/runtime)?


Denis
________________________________

vit esse estrany ☣

spir.wikidot.com
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to