[Pas2js] Question regarding the New() function (#34736)
Michael Van Canneyt
michael at freepascal.org
Thu Dec 20 17:09:32 CET 2018
On Thu, 20 Dec 2018, silvioprog wrote:
> On Thu, Dec 20, 2018 at 12:53 PM Michael Van Canneyt <michael at freepascal.org>
> wrote:
>
>> I don't want too much "tricks" in the compiler.
>
>
> Me too, but ...
>
>
>> If later we can think of a
>> way to do this in a good pascal-ish manner, we'll of course do it.
>>
>
> ... a pascal-ish manner, should be:
>
> var
> o: TJSObject;
> begin
> o := TJSObject.new([
> 'foo', 'bar',
> 'object', TJSObject.new(['abc', 123]),
> 'array', TJSArray.new(1,2,3)
> ]);
> Writeln(TJSJSON.stringify(o));
> end.
I agree. When we have type helpers, this will be possible.
Michael.
More information about the Pas2js
mailing list