<br><br><div class="gmail_quote">On 2 June 2010 11:34, spir <span dir="ltr"><<a href="mailto:denis.spir@gmail.com">denis.spir@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hello,<br>
<br>
<br>
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.<br>
writeln(recordTostr(aPosition)) // --> (x:1 ; y:2 ; z:3)<br>
writeln(arrayTostr(someInts)) // --> (9, 8, 7)<br>
(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 :-)<br>
</blockquote><div><br>ooh. php has 'print_r' for printing arrays/objects - an equivalent ArrayToStr would be handy to have in Pascal. while pascal is my favourite language, I'm finding it poorly supported compared with php :(<br>
<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
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)?<br>
<div class="im"><br>
<br>
Denis<br></div></blockquote><div><br>- V<br></div></div><br>