<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">On Thu, Dec 20, 2018 at 12:53 PM Michael Van Canneyt <<a href="mailto:michael@freepascal.org">michael@freepascal.org</a>> wrote: </div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I don't want too much "tricks" in the compiler.</blockquote><div><br></div><div>Me too, but ...</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">If later we can think of a<br>
way to do this in a good pascal-ish manner, we'll of course do it.<br></blockquote><div><br></div><div>... a pascal-ish manner, should be:</div><div><br></div><div><div>var</div><div> o: TJSObject;</div><div>begin</div><div> o := TJSObject.new([</div><div> 'foo', 'bar',</div><div> 'object', TJSObject.new(['abc', 123]),</div><div> 'array', TJSArray.new(1,2,3)</div><div> ]);</div><div> Writeln(TJSJSON.stringify(o));</div><div>end.</div><div><br></div><div>or:</div><div><br></div><div>var</div><div> o: TJSObject;</div><div>begin</div><div> o := TJSObject.new(</div><div> 'foo', 'bar',</div><div> 'object', TJSObject.new('abc', 123),</div><div> 'array', TJSArray.new(1,2,3)</div><div> );</div><div> Writeln(TJSJSON.stringify(o));</div><div>end.</div></div><div><br></div><div>however, it seems not possible. Anyway, these syntax above are better than the newObject()/newArray() ones. Another possibility (very verbose, but ...) would:</div><div><br></div><div><div>var</div><div> o: TJSObject;</div><div>begin</div><div> o := TJSObject.new(</div><div> TJSPair.new('foo', 'bar',)</div><div> TJSPair.new('object', TJSObject.new('abc', 123)),</div><div> TJSPair.new('array', TJSArray.new(1,2,3))</div><div> );</div><div> Writeln(TJSJSON.stringify(o));</div><div>end.</div></div><div><br></div><div>--<br></div></div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div></div></div></div>